Commit 3209ff350c18be85d96adb74621015803a277c2d
1 parent
8ffa32e9
Exists in
master
and in
23 other branches
Add the new permission to the 'admin' and 'moderator' roles in all environments
(ActionItem2388)
Showing
1 changed file
with
23 additions
and
0 deletions
Show diff stats
db/migrate/20120824165019_add_permission_for_send_mail_to_members_to_admin_and_moderator_roles.rb
0 → 100644
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +class AddPermissionForSendMailToMembersToAdminAndModeratorRoles < ActiveRecord::Migration | |
| 2 | + def self.up | |
| 3 | + Environment.all.map(&:id).each do |id| | |
| 4 | + role = Profile::Roles.admin(id) | |
| 5 | + role.permissions += ['send_mail_to_members'] | |
| 6 | + role.save! | |
| 7 | + role = Profile::Roles.moderator(id) | |
| 8 | + role.permissions += ['send_mail_to_members'] | |
| 9 | + role.save! | |
| 10 | + end | |
| 11 | + end | |
| 12 | + | |
| 13 | + def self.down | |
| 14 | + Environment.all.map(&:id).each do |id| | |
| 15 | + role = Profile::Roles.admin(id) | |
| 16 | + role.permissions -= ['send_mail_to_members'] | |
| 17 | + role.save! | |
| 18 | + role = Profile::Roles.moderator(id) | |
| 19 | + role.permissions -= ['send_mail_to_members'] | |
| 20 | + role.save! | |
| 21 | + end | |
| 22 | + end | |
| 23 | +end | ... | ... |