-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AO3-6754 Restrict access to API tokens (#4871)
* AO3-6754 Added authorization and policy on controller to ensure only superadmin can access /api paths * AO3-6754 Only show Manage API Tokens in header for super admins * AO3-6754 Remove Manage from API Tokens heading * AO3-6754 Rename browser titles for api tokens * AO3-6754 Add authorization for POST api token endpoints * AO3-6754 Add newline to end of file * AO3-6754 Normalize I18n en files * AO3-6754 override page_subtitle instead of page_title * AO3-6754 authorize ApiKey in one line * AO3-6754 use index policy to show/hide API Tokens link * AO3-6754 use better naming for note key in form * AO3-6754 normalize i18n file
- Loading branch information
1 parent
f7c1111
commit fff3a6d
Showing
6 changed files
with
412 additions
and
153 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class ApiKeyPolicy < ApplicationPolicy | ||
PERMITTED_ROLES = %w[superadmin].freeze | ||
|
||
def index? | ||
user_has_roles?(PERMITTED_ROLES) | ||
end | ||
|
||
alias show? index? | ||
alias new? index? | ||
alias edit? index? | ||
alias create? index? | ||
alias update? index? | ||
alias destroy? index? | ||
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
Oops, something went wrong.