Commit 2d6a3e6b67ec1c469ac19d2d5e581d8425b229c6
1 parent
22ec4637
Exists in
master
and in
4 other branches
Task to assign user developer role to all projects
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
lib/tasks/bulk_add_permission.rake
| @@ -14,3 +14,13 @@ task :add_users_to_project_teams => :environment do |t, args| | @@ -14,3 +14,13 @@ task :add_users_to_project_teams => :environment do |t, args| | ||
| 14 | UsersProject.bulk_import(project, admins, UsersProject::MASTER) | 14 | UsersProject.bulk_import(project, admins, UsersProject::MASTER) |
| 15 | end | 15 | end |
| 16 | end | 16 | end |
| 17 | + | ||
| 18 | +desc "Add user to as a developer to all projects" | ||
| 19 | +task :add_user_to_project_teams, [:email] => :environment do |t, args| | ||
| 20 | + user_email = args.email | ||
| 21 | + user = User.find_by_email(user_email) | ||
| 22 | + | ||
| 23 | + project_ids = Project.all.map(&:id) | ||
| 24 | + | ||
| 25 | + UsersProject.user_bulk_import(user,project_ids,UsersProject::DEVELOPER) | ||
| 26 | +end |