Commit dfdfb1064f0e2ab10b27c63a8f5ec6a206775140
1 parent
4b0c037f
Exists in
master
and in
29 other branches
Adding migration to include manage trusted sites permission to admin role
Showing
1 changed file
with
17 additions
and
0 deletions
Show diff stats
db/migrate/20130711213046_add_manage_environment_trusted_sites_to_admin_role.rb
0 → 100644
| @@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
| 1 | +class AddManageEnvironmentTrustedSitesToAdminRole < ActiveRecord::Migration | ||
| 2 | + def self.up | ||
| 3 | + Environment.all.map(&:id).each do |id| | ||
| 4 | + role = Environment::Roles.admin(id) | ||
| 5 | + role.permissions << 'manage_environment_trusted_sites' | ||
| 6 | + role.save! | ||
| 7 | + end | ||
| 8 | + end | ||
| 9 | + | ||
| 10 | + def self.down | ||
| 11 | + Environment.all.map(&:id).each do |id| | ||
| 12 | + role = Environment::Roles.admin(id) | ||
| 13 | + role.permissions -= ['manage_environment_trusted_sites'] | ||
| 14 | + role.save! | ||
| 15 | + end | ||
| 16 | + end | ||
| 17 | +end |