Class: Aker::GroupMembership
- Inherits:
-
Object
- Object
- Aker::GroupMembership
- Defined in:
- lib/aker/group_membership.rb
Overview
The authority-independent representation of a user's association with a particular group, possibly constrained by affiliate.
Instance Attribute Summary (collapse)
-
- (Array<Object>) affiliate_ids
The affiliate IDs to which this membership is scoped.
Instance Method Summary (collapse)
-
- (Group) group
The group for which this is a membership.
-
- (String) group_name
The name of the group for which this object indicates membership.
-
- (Boolean) include_affiliate?(affiliate_id)
Determines whether this membership applies to the given affiliate.
-
- (GroupMembership) initialize(group)
constructor
Create a new instance.
Constructor Details
- (GroupMembership) initialize(group)
Create a new instance.
24 25 26 |
# File 'lib/aker/group_membership.rb', line 24 def initialize(group) @group = group end |
Instance Attribute Details
- (Array<Object>) affiliate_ids
The affiliate IDs to which this membership is scoped. If this array is blank or nil, the membership applies to all affiliates.
An "affiliate" is an arbitrary scope designator for a membership. The specific form will depend on the authority that is authorizing the user.
17 18 19 |
# File 'lib/aker/group_membership.rb', line 17 def affiliate_ids @affiliate_ids ||= [] end |
Instance Method Details
- (Group) group
The group for which this is a membership
47 48 49 |
# File 'lib/aker/group_membership.rb', line 47 def group @group end |
- (String) group_name
The name of the group for which this object indicates membership.
41 42 43 |
# File 'lib/aker/group_membership.rb', line 41 def group_name self.group.name end |
- (Boolean) include_affiliate?(affiliate_id)
Determines whether this membership applies to the given affiliate.
34 35 36 |
# File 'lib/aker/group_membership.rb', line 34 def include_affiliate?(affiliate_id) affiliate_ids.blank? ? true : affiliate_ids.include?(affiliate_id) end |