Module: TroleGroups::Api::Write::ClassMethods

Defined in:
lib/trole_groups/api/write.rb

Instance Method Summary collapse

Instance Method Details

#set_valid_rolegroups(*rolegroups) ⇒ Object

Note:

this in effect limits what rolegroups can be assigned to any instance of the class

Sets which rolegroups are valid for the rolegroup subject class (fx User or UserAccount)

Parameters:

  • list (Array<Symbol>)

    of rolegroup names

Raises:

  • (ArgumentError)


53
54
55
56
57
# File 'lib/trole_groups/api/write.rb', line 53

def set_valid_rolegroups *rolegroups
  rolegroups = rolegroups.to_symbols_uniq
  raise ArgumentError, "Roles must contain Symbols or Strings" if rolegroups.empty?
  @valid_rolegroups = rolegroups
end