module TroleGroups::Api::Write
Public Instance Methods
Add a single new rolegroup to the rolegroups of the subject @param [Symbol] rolegroup to add @return (see add_rolegroups
)
# File lib/trole_groups/api/write.rb, line 6 def add_rolegroup rolegroup_name raise ArgumentError, "Take a single rolegroup name, was: #{rolegroup_name}" if !rolegroup_name || !rolegroup_name.kind_of_label? add_rolegroups rolegroup_name end
Adds a set of new rolegroups to the rolegroups of the subject @param [Array<Symbol>] list of rolegroups to add @return [true, false, Error] true if ok, false if static or invalid, Error on some error
# File lib/trole_groups/api/write.rb, line 22 def add_rolegroups *new_rolegroups group_store.set_rolegroups (rolegroup_list | new_rolegroups.to_symbols_uniq) # Set Union (joined set) end
Clears all the rolegroups of the subject @return [true, false, Error] true if ok, false if rolegroups are static, Error on some error
# File lib/trole_groups/api/write.rb, line 43 def clear_rolegroups! group_store.clear! end
Remove a single rolegroup from the rolegroups of the subject @param [Symbol] rolegroup to remove @return (see remove_rolegroups
)
# File lib/trole_groups/api/write.rb, line 14 def remove_rolegroup rolegroup_name raise ArgumentError, "Take a single rolegroup name, was: #{rolegroup_name}" if !rolegroup_name || !rolegroup_name.kind_of_label? remove_rolegroups rolegroup_name end
Removes a set of new rolegroups to the rolegroups of the subject (see add_rolegroups
)
# File lib/trole_groups/api/write.rb, line 28 def remove_rolegroups *the_rolegroups group_store.set_rolegroups (rolegroup_list - the_rolegroups.to_symbols_uniq) end
Sets new rolegroups for the subject @param [Array<Symbol>] list of rolegroup names @return [true, false, Error] true if set ok, false if any rolegroups were invalid, Error on some error
# File lib/trole_groups/api/write.rb, line 35 def set_rolegroups *rolegroups rolegroups_to_set = make_valid_rolegroups(*rolegroups).flat_uniq return false if !rolegroups_to_set || rolegroups_to_set.empty? group_store.set_rolegroups(rolegroups_to_set) end