Skip to content

Commit

Permalink
Move readme step to a rake task (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcorrea authored Aug 20, 2024
1 parent 18101e3 commit 4635090
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ irb(main):016:0> user.add_role(:group_admin, Group.research_data)
```

## PPPL submitters
To allow a non-admin user to submit only to the PPPL group and its communities and subcommunities, that user's default Group must be set to the Princeton Plasma Physics Lab and their roles must be updated. To do this, use the Rails console:
To allow a non-admin user to submit only to the PPPL group and its communities and subcommunities, that user's default Group must be set to the Princeton Plasma Physics Lab and their roles must be updated. To do this, use the Rake task `users:make_pppl_user` and pass the `netid` of the user to update:

```
irb(main):011:0> user = User.find_by(uid: 'hb0344')
irb(main):012:0> user.default_group_id = Group.plasma_laboratory.id
irb(main):013:0> user.add_role(:submitter, Group.plasma_laboratory)
irb(main):014:0> user.remove_role(:submitter, Group.research_data)
irb(main):015:0> user.save!
bundle exec rake users:make_pppl_user[xx123]
```

## Viewing the Application outside of the load balancer
Expand Down
11 changes: 11 additions & 0 deletions lib/tasks/users.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ namespace :users do
User.create_default_users
end

desc "Set a user to be a PPPL user."
task :make_pppl_user, [:netid] => :environment do |_, args|
netid = args[:netid]
user = User.find_by(uid: netid)
user.default_group_id = Group.plasma_laboratory.id
user.add_role(:submitter, Group.plasma_laboratory)
user.remove_role(:submitter, Group.research_data)
user.save!
puts "Switched user #{netid} to PPPL group"
end

# Use this task to regenerate the group_defaults.yml file with the data currently
# in the database. This is useful to seed the data from one environment to another.
desc "Outputs to the console the user/group admin rights in YAML format"
Expand Down

0 comments on commit 4635090

Please sign in to comment.