diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-05 18:42:57 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-10 19:43:01 +0200 |
commit | 6114c40fca764602addc911bc58bc05c42e03747 (patch) | |
tree | 85d22c3ffba3d39383d95f6442ccfb20207124c1 /app/policies/project_policy | |
parent | bdd7600de71c9490be4ba4ddc27999b490b7cf8a (diff) | |
download | gitlab-ce-6114c40fca764602addc911bc58bc05c42e03747.tar.gz |
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.rb | 19 |
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 |