blob: 0e010aa5c337be9fc0c9cbb71fd1e9954f80000e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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
|