module TroleGroups::Api::Read

Public Instance Methods

has_any_rolegroup?(*rolegroups)
Alias for: in_any_rolegroup?
has_rolegroup?(rolegroup)
Alias for: in_rolegroup?
has_rolegroups?(*rolegroups)
Alias for: in_rolegroups?
in_any_rolegroup?(*rolegroups) click to toggle source

union of rolegroups and rolegroups_list is not empty

# File lib/trole_groups/api/read.rb, line 29
def in_any_rolegroup? *rolegroups
  !(rolegroup_list & rolegroups.to_symbols).empty?
end
Also aliased as: has_any_rolegroup?
in_rolegroup?(rolegroup) click to toggle source

any? on rolegroups_list

# File lib/trole_groups/api/read.rb, line 12
def in_rolegroup? rolegroup
  rolegroup_list.include? rolegroup.to_sym
end
Also aliased as: has_rolegroup?
in_rolegroups?(*rolegroups) click to toggle source

subtraction of role_groups from rolegroups_list is empty

# File lib/trole_groups/api/read.rb, line 23
def in_rolegroups? *rolegroups
  (rolegroups.to_symbols - rolegroup_list).empty?
end
Also aliased as: has_rolegroups?
only_in_rolegroup?(rolegroup) click to toggle source

rolegroup_list has one element which is rolegroup

# File lib/trole_groups/api/read.rb, line 18
def only_in_rolegroup? rolegroup
  rolegroup_list.first == rolegroup.to_sym && rolegroup_list.size == 1      
end
role_list() click to toggle source

Ensures that the common API methods always have a common underlying model to work on @note This Set should be cached and only invalidated when the user has a change of roles

@return Array<Symbol> Set of role names

# File lib/trole_groups/api/read.rb, line 50
def role_list        
  @role_list ||= begin
    (store.display_roles | group_store.display_roles)
  end
end
rolegroup_list() click to toggle source

return Set of symbols,where each symbol is a rolegroup name This set should be cached and only invalidated when the user has a change of roles

# File lib/trole_groups/api/read.rb, line 41
def rolegroup_list
  @rolegroup_list ||= begin
    group_store.display_rolegroups
  end
end
roles_for(*names) click to toggle source
# File lib/trole_groups/api/read.rb, line 7
def roles_for *names
  group_store.display_roles_for *names
end
roles_from_rolegroups() click to toggle source
# File lib/trole_groups/api/read.rb, line 3
def roles_from_rolegroups
  group_store.display_roles
end
roles_of(rolegroup) click to toggle source

return roles of that rolegroup

# File lib/trole_groups/api/read.rb, line 35
def roles_of rolegroup
  raise "Pending"
end