Defect #15881

Using Role::PermissionsAttributeCoder makes migration from 1.4 lose role permissions

Added by David Escala over 5 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:


Category:Permissions and roles
Target version:-
Resolution:Invalid Affected version:2.4.2


In 1.4 permissions are serialized as

  - !ruby/sym add_project
  - !ruby/sym edit_project



fails to load it. next thing it is saved empty.


#1 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from New to Needs feedback
  • Resolution set to Cant reproduce

Please read SubmittingBugs. And what was the ruby version that you used with 1.4?

#2 Updated by David Escala over 5 years ago

This is the old environment from which the database is coming from:

Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.8.24
Rails version             2.3.17
Database adapter          mysql

And this is the target environment:

  Redmine version                2.4.2.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.16
  Database adapter               Mysql2

In the old environment a Symbol object is serialized as

>> :add_project.to_yaml
=> "--- !ruby/sym add_project" 

instead of

>> :add_project.to_yaml
=> "--- :add_project\n" 

I don't know the reason of this difference, though both are valid YAML representations of a Symbol object.

#3 Updated by David Escala over 5 years ago

My setup is serializing this way because it uses a plugin which replaces YAML with ZAML

To avoid hitting this bug use this patch

--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -58,7 +58,7 @@ class Role < ActiveRecord::Base
   has_many :members, :through => :member_roles

-  serialize :permissions, ::Role::PermissionsAttributeCoder
+  serialize :permissions
   attr_protected :builtin

   validates_presence_of :name

#4 Updated by Go MAEDA over 4 years ago

  • Status changed from Needs feedback to Closed
  • Resolution changed from Cant reproduce to Invalid

Thanks for providing details.
The cause of the error was plugin, not Redmine core. I close this issue.

Also available in: Atom PDF