move policy method to the ownly policy it is used in

parent 6adaf924
Pipeline #77082 failed with stage
in 10 minutes and 15 seconds
......@@ -124,10 +124,6 @@ class ApplicationPolicy
superadmin? || (department_manager? && departments_record?)
end
def superadmin_or_user_in_records_related?
superadmin? || record.user_ids.include?(user.id)
end
def superadmin_or_volunteers_record?
superadmin? || volunteer? && user_owns_record?
end
......
......@@ -12,6 +12,10 @@ class DepartmentPolicy < ApplicationPolicy
alias_method :create?, :superadmin?
alias_method :destroy?, :superadmin?
def superadmin_or_user_in_records_related?
superadmin? || record.user_ids.include?(user.id)
end
alias_method :show?, :superadmin_or_user_in_records_related?
alias_method :edit?, :superadmin_or_user_in_records_related?
alias_method :update?, :superadmin_or_user_in_records_related?
......
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