diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/policies/concerns | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/policies/concerns')
-rw-r--r-- | app/policies/concerns/crud_policy_helpers.rb | 10 | ||||
-rw-r--r-- | app/policies/concerns/readonly_abilities.rb | 52 |
2 files changed, 60 insertions, 2 deletions
diff --git a/app/policies/concerns/crud_policy_helpers.rb b/app/policies/concerns/crud_policy_helpers.rb index d8521ca22cc..029c196cc5f 100644 --- a/app/policies/concerns/crud_policy_helpers.rb +++ b/app/policies/concerns/crud_policy_helpers.rb @@ -13,10 +13,16 @@ module CrudPolicyHelpers def create_update_admin_destroy(name) [ + *create_update_admin(name), + :"destroy_#{name}" + ] + end + + def create_update_admin(name) + [ :"create_#{name}", :"update_#{name}", - :"admin_#{name}", - :"destroy_#{name}" + :"admin_#{name}" ] end end diff --git a/app/policies/concerns/readonly_abilities.rb b/app/policies/concerns/readonly_abilities.rb new file mode 100644 index 00000000000..a267e963541 --- /dev/null +++ b/app/policies/concerns/readonly_abilities.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module ReadonlyAbilities + extend ActiveSupport::Concern + + READONLY_ABILITIES = %i[ + admin_tag + push_code + push_to_delete_protected_branch + request_access + upload_file + resolve_note + create_merge_request_from + create_merge_request_in + award_emoji + ].freeze + + READONLY_FEATURES = %i[ + issue + list + merge_request + label + milestone + snippet + wiki + design + note + pipeline + pipeline_schedule + build + trigger + environment + deployment + commit_status + container_image + pages + cluster + release + ].freeze + + class_methods do + def readonly_abilities + READONLY_ABILITIES + end + + def readonly_features + READONLY_FEATURES + end + end +end + +ReadonlyAbilities::ClassMethods.prepend_if_ee('EE::ReadonlyAbilities::ClassMethods') |