Project

General

Profile

Actions

Defect #15881

closed

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

Added by David Escala almost 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Permissions and roles
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

In 1.4 permissions are serialized as

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

and

scan(/:([a-z0-9_]+)/).flatten.map(&:to_sym)

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

Actions #1

Updated by Jean-Philippe Lang almost 11 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?

Actions #2

Updated by David Escala almost 11 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.

Actions #3

Updated by David Escala almost 11 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
   acts_as_list

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

   validates_presence_of :name
Actions #4

Updated by Go MAEDA over 9 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.

Actions

Also available in: Atom PDF