docbrown/spec/system/admin
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
..
admin_awards_badges_spec.rb Use Rails path helpers in admin system specs (#11399) 2020-11-13 10:45:57 -06:00
admin_bans_or_warns_user_spec.rb Refactoring questions asked of user (#15762) 2021-12-21 12:45:12 -05:00
admin_creates_new_page_spec.rb [15-minute fix] Disable 'Locked Screen' prompt for public Forems (#14029) 2021-06-30 10:09:38 +07:00
admin_creates_new_tag_spec.rb Adds local: true to admin/tags/edit.html.erb remove mod button (#14057) 2021-06-23 12:34:53 -06:00
admin_deletes_user_spec.rb Use Rails path helpers in admin system specs (#11399) 2020-11-13 10:45:57 -06:00
admin_invites_user_spec.rb Only enable user invitations page when SMTP is enabled (#15219) 2021-10-29 17:41:30 +02:00
admin_manages_configuration_spec.rb Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
admin_manages_organizations_spec.rb Uncomments line 26 in admin_manages_organizations_spec.rb (#14051) 2021-06-23 09:22:59 +02:00
admin_manages_pages_spec.rb Spelling (#15702) 2021-12-07 06:59:10 -07:00
admin_manages_profile_fields_spec.rb Adds a feature flag for Data Update Scripts (#12641) 2021-02-10 18:22:27 +02:00
admin_manages_reports_spec.rb [deploy] Adding Crayons to Admin (#10015) 2020-08-31 10:29:06 -04:00
admin_updates_tag_spec.rb Spelling (#15702) 2021-12-07 06:59:10 -07:00
admin_views_tags_spec.rb Add sorting feature to /admin/tags (#12249) 2021-01-13 17:03:17 -05:00
admin_visits_overview_spec.rb Update admin welcome checklist (#14261) 2021-07-28 14:27:17 -04:00
user_email_tools_spec.rb Create Settings::SMTP (#13943) 2021-06-14 10:29:43 -04:00