Class: CanTango::Permits::RoleGroupPermit::Builder
Instance Attribute Summary
#ability
Instance Method Summary
collapse
#debug
#initialize
Instance Method Details
#build ⇒ Array<RoleGroupPermit::Base>
builds a list of Permits for each role group of the current ability user (or account)
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/cantango/permits/role_group_permit/builder.rb', line 8
def build
matching_permits = matching_role_groups(roles).inject([]) do |permits, role_group|
debug "Building RoleGroupPermit for #{role_group}"
(permits << create_permit(role_group)) if valid?(role_group)
permits
end.compact
if matching_permits.empty?
debug "Not building any RoleGroupPermits since no role groups could be found that are relevant for the permission candidate"
return []
end
matching_permits
end
|
#filter(role_group) ⇒ Object
#name ⇒ Object
22
23
24
|
# File 'lib/cantango/permits/role_group_permit/builder.rb', line 22
def name
:role_group
end
|
#valid?(role_group) ⇒ Boolean
26
27
28
29
|
# File 'lib/cantango/permits/role_group_permit/builder.rb', line 26
def valid? role_group
return true if !role_groups_filter?
filter(role_group).valid?
end
|