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
-
#affiliate_ids ⇒ Array<Object>
The affiliate IDs to which this membership is scoped.
Instance Method Summary collapse
-
#group ⇒ Group
The group for which this is a membership.
-
#group_name ⇒ String
The name of the group for which this object indicates membership.
-
#include_affiliate?(affiliate_id) ⇒ Boolean
Determines whether this membership applies to the given affiliate.
-
#initialize(group) ⇒ GroupMembership
constructor
Create a new instance.
Constructor Details
#initialize(group) ⇒ GroupMembership
Create a new instance.
24 25 26 |
# File 'lib/aker/group_membership.rb', line 24 def initialize(group) @group = group end |
Instance Attribute Details
#affiliate_ids ⇒ Array<Object>
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
Returns the group for which this is a membership.
47 48 49 |
# File 'lib/aker/group_membership.rb', line 47 def group @group end |
#group_name ⇒ String
Returns 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 |
#include_affiliate?(affiliate_id) ⇒ Boolean
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 |