-
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.
This contains changes from #2988 which should go away once that's merged
- Loading branch information
Showing
9 changed files
with
24 additions
and
15 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
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,15 +1,17 @@ | ||
class UserApplicationPermissionPolicy < BasePolicy | ||
def create? | ||
return false unless Pundit.policy(current_user, user).edit? | ||
|
||
return true if current_user.govuk_admin? | ||
return false unless current_user.publishing_manager? && current_user.has_access_to?(application) | ||
|
||
permission = supported_permission || application.signin_permission | ||
|
||
current_user.publishing_manager? && current_user.has_access_to?(application) && application.signin_permission.delegatable? | ||
current_user.has_permission?(permission) && permission.delegatable? | ||
end | ||
alias_method :destroy?, :create? | ||
alias_method :delete?, :create? | ||
alias_method :update?, :create? | ||
alias_method :edit?, :create? | ||
|
||
delegate :user, :application, to: :record | ||
delegate :user, :application, :supported_permission, to: :record | ||
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