docbrown/app/views/admin/users
Jeremy Friesen a40efc6bbd
Refactoring questions asked of user (#15762)
* Refactoring questions asked of user

In this pull request, I'm extracting and normalizing role-based
questions asked of the user.

Prior to this commit, our codebase has asked two very similar questions
of our user model:

- `user.has_role?(:admin)`
- `user.admin?`

In asking `has_role?(:admin)` we are relying on implementation details
of the rolify gem.  In addition, the `has_role?` question asked
throughout controllers or views means that it's harder to create
hieararchies of permissions.

In favoring `user.admin?` as our question, we can use that indirection
as an opportunity to discuss and decide "Should someone with the
`:super_admin` role be `user.admin? == true`?"

The details of this commit is to do three primary things:

1. Ask the `has_role?` questions in "one place" in the code (e.g. the
   `Authorizer` module)
2. Extract the role based questions that are on the `User` model and
   provde backwards compatable delegation.
3. Structure the code so that it's harder to accidentally call
   `user.has_role?` (e.g., make `User#has_role?` and `User#has_any_role?`
   private).

This is related to #15624 and the updates are informed by discussion in
PR #15691.  This commit supplants #15691.

* Refactoring the liquid tag policy tests

* Fixing typo

* Bump for travis
2021-12-21 12:45:12 -05:00
..
gdpr_delete_requests crayons-notice accessibility improvements (#13273) 2021-04-14 13:32:57 +01:00
new Admin Member view: add Tools::HeaderComponent to reduce duplication (#14558) 2021-08-24 15:08:48 +02:00
_activity.html.erb Remove Roles via Admin (#12582) [deploy] 2021-02-16 10:50:10 -07:00
_credits.html.erb [deploy] Add Recent Vomit Reaction Reports to Users' Admin Users Page (#10059) 2020-08-31 11:23:19 -04:00
_current_roles.html.erb Rename banned and comment_banned roles (#12270) 2021-04-06 10:12:14 -05:00
_data_export.html.erb Removing Settings::General.email_addresses (#13958) 2021-06-11 12:34:34 +03:00
_email_tools.html.erb Refactor Admin Member Detail view - Tools section (#14283) 2021-08-17 18:55:53 +02:00
_menu.html.erb Confirmations that users GDPR data was deleted (#11039) 2020-12-14 12:49:45 +03:00
_negative_reactions.html.erb Updates Recent Reactions + Reports buttons to match other buttons (#12153) [deploy] 2021-01-06 15:05:21 -07:00
_notes.html.erb crayons-notice accessibility improvements (#13273) 2021-04-14 13:32:57 +01:00
_reports.html.erb Updates Recent Reactions + Reports buttons to match other buttons (#12153) [deploy] 2021-01-06 15:05:21 -07:00
_user_organizations.html.erb [deploy] Adding Crayons to Admin (#10015) 2020-08-31 10:29:06 -04:00
edit.html.erb Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
index.html.erb Override specified line break behaviour on the ID column (#12076) 2021-01-04 16:17:38 -05:00
show.html.erb Fixes "Invite Flow" 404s for Unregistered Users (#10743) [deploy] 2020-10-13 07:53:29 -06:00