diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-20 11:38:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-20 11:38:20 +0000 |
commit | 48fb02e3839c30667733e59415d98c373467876b (patch) | |
tree | e7fbabd25d1f5e1c2cc3a55d1c5bddc45dcc70e1 /db/migrate | |
parent | 26016cdc086ad61075512414e72b3f3b9b6d8069 (diff) | |
download | redmine-48fb02e3839c30667733e59415d98c373467876b.tar.gz redmine-48fb02e3839c30667733e59415d98c373467876b.zip |
Split "Manage documents" permission into create, edit and delete permissions (#12401).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11206 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20130110122628_split_documents_permissions.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/db/migrate/20130110122628_split_documents_permissions.rb b/db/migrate/20130110122628_split_documents_permissions.rb new file mode 100644 index 000000000..0e010aa5c --- /dev/null +++ b/db/migrate/20130110122628_split_documents_permissions.rb @@ -0,0 +1,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 |