Toggling admin outside of the linker - brownfield-team/anacapa-github-linker GitHub Wiki

When working as a dev, it is usually convenient to be an admin, so that you can do all of the things in the app.

Except, when you are trying to work on the view that a particular role should see:

  • Instructors should only be able to see detailed information for their own courses, not other instructors courses.
  • Students should only see their own information, for courses in which they are enrolled, and may have some limited visibility to information for their teams.

Therefore, we sometimes need to turn off our admin access. And we need to be able to turn it back on outside of the linker.

Toggling your access with rails c

This allows you to get a handle on a particular user

u = User.where(username: "pconrad").first

To check their role, do this:

u.highest_role

If they show as an admin, you can toggle that with:

u.change_admin_status