-
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-6698 Limit roles that can modify archive FAQs (#4894)
* AO3-6698 Add authorization to archive faqs controller * AO3-6698 Forbid creation, reordering and deletion of non-English FAQ categories * AO3-6698 Add authorization to archive faq questions controller * AO3-6698 Hide links to unavailable FAQ actions * AO3-6698 I18n and fix tests * AO3-6698 Shut up rubocop * AO3-6698 Fix flaky test * AO3-6698 Review fixes * AO3-6698 Fix tests
- Loading branch information
Showing
16 changed files
with
596 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
class ArchiveFaqPolicy < ApplicationPolicy | ||
TRANSLATION_ACCESS_ROLES = %w[superadmin docs support translation].freeze | ||
# a subset of TRANSLATION_ACCESS_ROLES | ||
FULL_ACCESS_ROLES = %w[superadmin docs support].freeze | ||
|
||
def translation_access? | ||
user_has_roles?(TRANSLATION_ACCESS_ROLES) | ||
end | ||
|
||
def full_access? | ||
user_has_roles?(FULL_ACCESS_ROLES) | ||
end | ||
|
||
alias edit? translation_access? | ||
alias update? translation_access? | ||
alias new? full_access? | ||
alias create? full_access? | ||
alias manage? full_access? | ||
alias update_positions? full_access? | ||
alias confirm_delete? full_access? | ||
alias destroy? full_access? | ||
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
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.