discourse/lib/guardian/group_guardian.rb

12 lines
391 B
Ruby

#mixin for all guardian methods dealing with group permissions
module GroupGuardian
# Edit authority for groups means membership changes only.
# Automatic groups are not represented in the GROUP_USERS
# table and thus do not allow membership changes.
def can_edit_group?(group)
(group.users.where('group_users.owner').include?(user) || is_admin?) && !group.automatic
end
end