Commit c7136b6a authored by Bob Van Landuyt's avatar Bob Van Landuyt

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.
parent 4074283d
class ProjectPolicy < BasePolicy
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
extend ClassMethods
prepend EE::ProjectPolicy
READONLY_FEATURES_WHEN_ARCHIVED = %i[
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment