Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-05 19:42:57 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-10 20:43:01 +0300
commit6114c40fca764602addc911bc58bc05c42e03747 (patch)
tree85d22c3ffba3d39383d95f6442ccfb20207124c1 /app/policies/project_policy
parentbdd7600de71c9490be4ba4ddc27999b490b7cf8a (diff)
Move `ProjectPolicy`-class methods into module
That way the ProjectPolicy class can be extended with this module before we prepend the EE::ProjectPolicy. This makes the classmethods available for rules defined in the EE::ProjectPolicy.
Diffstat (limited to 'app/policies/project_policy')
-rw-r--r--app/policies/project_policy/class_methods.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/policies/project_policy/class_methods.rb b/app/policies/project_policy/class_methods.rb
new file mode 100644
index 00000000000..60e5aba00ba
--- /dev/null
+++ b/app/policies/project_policy/class_methods.rb
@@ -0,0 +1,19 @@
+class ProjectPolicy
+ module ClassMethods
+ 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