Class: Cms::Group
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Cms::Group
- Defined in:
- app/models/cms/group.rb
Overview
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.
Constant Summary collapse
- GUEST_CODE =
"guest"
Class Method Summary collapse
-
.guest ⇒ Object
Finds the guest group, which is a special group that represents public non-logged in users.
Instance Method Summary collapse
Class Method Details
.guest ⇒ Object
Finds the guest group, which is a special group that represents public non-logged in users.
38 39 40 |
# File 'app/models/cms/group.rb', line 38 def self.guest with_code(GUEST_CODE).first end |
Instance Method Details
#cms_access? ⇒ Boolean
33 34 35 |
# File 'app/models/cms/group.rb', line 33 def cms_access? group_type && group_type.cms_access? end |
#guest? ⇒ Boolean
29 30 31 |
# File 'app/models/cms/group.rb', line 29 def guest? group_type && group_type.guest? end |
#has_permission?(permission) ⇒ Boolean
43 44 45 46 47 48 |
# File 'app/models/cms/group.rb', line 43 def () .any? do |p| return true if .to_sym == p.name.to_sym end false end |