app/models/abilities/attachment_ability.rb
Consider simplifying this complex logical expression. Open
Open
if not read_only_mode?
can :update, Attachment do |attachment|
parent_ability_can?(:read, attachment) &&
(attachment.parent.respond_to?(:group) && attachment.parent.group) && (attachment.parent.group.officers_of_self_and_ancestors.include?(user)) &&
((attachment.author == user) || (attachment.parent.respond_to?(:author) && attachment.parent.author == user))