-
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.
WIP: Conditionally show the "Remove access" button
TODO: Move this earlier in the branch and see whether I can improve the tests by stubbing(?) the `policy` that ends up in the view. TODO: I've had to introduce a new policy because I didn't seem to be able to specify `policy_class` in the call to `policy` in the template. This suggests that I should probably make the same change elsewhere before doing anything else in this branch. Publishing Managers can only see the button if they have access and if the application has delegatable permissions.
- Loading branch information
Showing
3 changed files
with
28 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Account::ApplicationPolicy < BasePolicy | ||
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
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