Skip to content

Commit

Permalink
add api_users:reset_permissions rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Rossi committed Apr 9, 2016
1 parent 9d02589 commit 2f9defa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ ActiveRecordMigrations.configure do |c|
c.environment = $environment
end
ActiveRecordMigrations.load_tasks

# Load custom tasks from `lib/tasks` if you have any defined
Dir.glob('lib/tasks/*.rake').each { |r| import r }
12 changes: 12 additions & 0 deletions lib/tasks/api_users.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'models/api_user'

namespace :api_users do
desc "Reset permissions for all users"
task :reset_permissions => :environment do
ApiUser.all.each { |user|
user.send(:set_permissions)
user.save
puts "Permissions reset for #{user.email}"
}
end
end

0 comments on commit 2f9defa

Please sign in to comment.