Terra › module › Groups › class › Group
From Botdom Documentation
Instances of the User Group class are used to represent user groups in the system. The class contains methods which are useful for maintaining to user groups.
Contents |
Properties
Every instance of the class contains the following properties.
- str Name - The name of the user group.
- str Alias - The alias for the user group.
- str Inherit - The name of the user group the group inherits. If the group does not inherit any others, this is set to None.
- list Exclude - A list of the user groups that the group explicitly excludes.
- list Users - Objects representing the users who are a member of the group are kept here.
- obj Host - A reference to the user groups system object.
- str type - A string representation of the object in the format "<user group "Name">".
Methods
These functions should be used to maintain the group that the instance represents. For the most part, extensions should not have to call any of these methods.
void __init__(str name, dict Config, obj Host)
This method is called when an instance of the class is made. Config it must contain a specific set of key-value pairs. This method sets the properties for the class.
void deleteting(str name)
This method is called when a user group is being deleted. The input parameter name is the name of the group being deleted.
bool has(str name)
This method checks to see of the user defined in name is a member of the group. Returns True if they are a member, and False if not.
list add(str name)
This method attempts to add the user defined by name to the group's users. If successful, the first item of the returned list is True. If unsuccessful, the first item is set to False, and the second item provides a reason for the failure.
list remove(str name)
This is the opposite of add().
bool Inherits(str group)
This method checks if the group inherits the group defined by group.
bool Excludes(str group)
This method checks if the group excludes the group defined by group.
dict flatten(void)
This returns a dictionary containing data which is given to __init__ as Config.
str __str__(void)
This method returns the name of the user group.

