diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-05 19:42:57 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-10 20:43:01 +0300 |
commit | 6114c40fca764602addc911bc58bc05c42e03747 (patch) | |
tree | 85d22c3ffba3d39383d95f6442ccfb20207124c1 /app/policies/project_policy.rb | |
parent | bdd7600de71c9490be4ba4ddc27999b490b7cf8a (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.rb')
-rw-r--r-- | app/policies/project_policy.rb | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 91dd89a8de1..b4970b605ca 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -1,4 +1,6 @@ class ProjectPolicy < BasePolicy + extend ClassMethods + READONLY_FEATURES_WHEN_ARCHIVED = %i[ issue list @@ -20,22 +22,6 @@ class ProjectPolicy < BasePolicy cluster ].freeze - def self.create_read_update_admin_destroy(name) - [ - :"read_#{name}", - *create_update_admin_destroy(name) - ] - end - - def self.create_update_admin_destroy(name) - [ - :"create_#{name}", - :"update_#{name}", - :"admin_#{name}", - :"destroy_#{name}" - ] - end - desc "User is a project owner" condition :owner do (project.owner.present? && project.owner == @user) || |