-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Publishing Managers to use /account/applications
Publishing Managers can: - View permissions for all applications they have access to - Remove their access from applications with delegatable permissions Publishing Managers cannot: - Grant themselves access to applications - Remove their access from applications that don't have delegatable permissions
- Loading branch information
Showing
2 changed files
with
77 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
class Account::ApplicationPolicy < BasePolicy | ||
def index? | ||
current_user.govuk_admin? | ||
current_user.govuk_admin? || current_user.publishing_manager? | ||
end | ||
|
||
alias_method :show?, :index? | ||
alias_method :grant_signin_permission?, :index? | ||
alias_method :remove_signin_permission?, :index? | ||
alias_method :view_permissions?, :index? | ||
|
||
def grant_signin_permission? | ||
current_user.govuk_admin? | ||
end | ||
|
||
def remove_signin_permission? | ||
current_user.has_access_to?(record) && | ||
( | ||
current_user.govuk_admin? || | ||
current_user.publishing_manager? && record.signin_permission.delegatable? | ||
) | ||
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