-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AO3-6486 Add development_and_membership admin role (#4777)
* AO3-6486 Add development_and_membership admin role * AO3-6486 Make sure the proper options are shown or hidden * AO3-6486 Code style fixes
- Loading branch information
Showing
8 changed files
with
100 additions
and
26 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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
class AdminBannerPolicy < ApplicationPolicy | ||
ACCESS_AND_EDIT_ROLES = %w[superadmin board communications development_and_membership support].freeze | ||
CREATE_AND_DESTROY_ROLES = %w[superadmin board communications support].freeze | ||
|
||
def index? | ||
user_has_roles?(%w[superadmin board communications support]) | ||
user_has_roles?(ACCESS_AND_EDIT_ROLES) | ||
end | ||
|
||
def create? | ||
user_has_roles?(CREATE_AND_DESTROY_ROLES) | ||
end | ||
|
||
alias show? index? | ||
alias create? index? | ||
alias update? index? | ||
alias destroy? index? | ||
alias destroy? create? | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
<ul class="navigation actions"> | ||
<li><%= span_if_current ts('Banners'), admin_banners_path %></li> | ||
<li><%= span_if_current ts('New Banner'), new_admin_banner_path %></li> | ||
<li><%= span_if_current t(".index"), admin_banners_path %></li> | ||
<% if policy(AdminBanner).new? %> | ||
<li><%= span_if_current t(".new"), new_admin_banner_path %></li> | ||
<% end %> | ||
<% if params[:id] %> | ||
<li><%= span_if_current ts('Edit Banner'), edit_admin_banner_path(@admin_banner) %></li> | ||
<li><%= link_to ts('Delete Banner'), confirm_delete_admin_banner_path(@admin_banner), data: {confirm: ts('Are you sure you want to delete this banner?')} %></li> | ||
<li><%= span_if_current t(".edit"), edit_admin_banner_path(@admin_banner) %></li> | ||
<% if policy(AdminBanner).destroy? %> | ||
<li><%= link_to t(".delete"), confirm_delete_admin_banner_path(@admin_banner), data: { confirm: t(".confirm_delete") } %></li> | ||
<% end %> | ||
<% end %> | ||
</ul> |
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