app/models/group.rb in browsercms-3.0.2 vs app/models/group.rb in browsercms-3.0.3

- old
+ new

@@ -1,7 +1,13 @@ +# +# A group represents a collection of permissions. Each User can be assigned to one or more groups, and the sum of +# their permissions from all groups combined represents what they can do. +# class Group < ActiveRecord::Base - + + GUEST_CODE = "guest" + has_many :user_group_memberships has_many :users, :through => :user_group_memberships has_many :group_permissions has_many :permissions, :through => :group_permissions @@ -24,7 +30,12 @@ end def cms_access? group_type && group_type.cms_access? end - + + # Finds the guest group, which is a special group that represents public non-logged in users. + def self.guest + with_code(GUEST_CODE).first + end + end