mirror da
https://github.com/redmine/redmine.git
synced 2024-08-27 17:54:48 +02:00
![Jean-Philippe Lang](/assets/img/avatar_default.png)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11206 e93f8b46-1217-0410-a6f0-8f06a7374b81
24 righe
767 B
Ruby
24 righe
767 B
Ruby
class SplitDocumentsPermissions < ActiveRecord::Migration
|
|
def up
|
|
# :manage_documents permission split into 3 permissions:
|
|
# :add_documents, :edit_documents and :delete_documents
|
|
Role.all.each do |role|
|
|
if role.has_permission?(:manage_documents)
|
|
role.add_permission! :add_documents, :edit_documents, :delete_documents
|
|
role.remove_permission! :manage_documents
|
|
end
|
|
end
|
|
end
|
|
|
|
def down
|
|
Role.all.each do |role|
|
|
if role.has_permission?(:add_documents) ||
|
|
role.has_permission?(:edit_documents) ||
|
|
role.has_permission?(:delete_documents)
|
|
role.remove_permission! :add_documents, :edit_documents, :delete_documents
|
|
role.add_permission! :manage_documents
|
|
end
|
|
end
|
|
end
|
|
end
|