diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-13 18:09:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-13 18:09:20 +0300 |
commit | b77fb04678a4e76d025048e9846adc2ac709414a (patch) | |
tree | c65f719e326e1d33d313b5e9d8b3f72366ad7bd2 /app/policies/concerns | |
parent | 75ee59f7a108cf0c57e1e66e3ef5e439bae24fcd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies/concerns')
-rw-r--r-- | app/policies/concerns/crud_policy_helpers.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/policies/concerns/crud_policy_helpers.rb b/app/policies/concerns/crud_policy_helpers.rb new file mode 100644 index 00000000000..d8521ca22cc --- /dev/null +++ b/app/policies/concerns/crud_policy_helpers.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module CrudPolicyHelpers + extend ActiveSupport::Concern + + class_methods do + def create_read_update_admin_destroy(name) + [ + :"read_#{name}", + *create_update_admin_destroy(name) + ] + end + + def create_update_admin_destroy(name) + [ + :"create_#{name}", + :"update_#{name}", + :"admin_#{name}", + :"destroy_#{name}" + ] + end + end +end |