-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add legal role * Users: grant access to search and admin view * Comments: deletion, hiding, IP visability * Creations: hide/delete, view admin info * Test fixes and remove spam access * Increase test coverage of role access
- Loading branch information
1 parent
ac53277
commit 07358ee
Showing
10 changed files
with
434 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
class UserCreationPolicy < ApplicationPolicy | ||
FULL_ACCESS_ROLES = %w[superadmin legal policy_and_abuse].freeze | ||
|
||
def show_admin_options? | ||
destroy? || hide? || edit? | ||
end | ||
|
||
def destroy? | ||
user_has_roles?(%w[superadmin policy_and_abuse]) | ||
user_has_roles?(FULL_ACCESS_ROLES) | ||
end | ||
|
||
def hide? | ||
user_has_roles?(%w[superadmin policy_and_abuse]) | ||
user_has_roles?(FULL_ACCESS_ROLES) | ||
end | ||
|
||
def show_ip_address? | ||
user_has_roles?(%w[superadmin policy_and_abuse]) | ||
user_has_roles?(FULL_ACCESS_ROLES) | ||
end | ||
|
||
def show_original_creators? | ||
user_has_roles?(%w[superadmin policy_and_abuse]) | ||
user_has_roles?(FULL_ACCESS_ROLES) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.