The Role class is a Delegation which represents a specific user role in memory. A role is a set of permissions controlling assigned users’ access to the forum.
Numeric identifier for the role represented by a Role instance. The default value is ‘0’ (denoting a new role that isn’t stored in the database). (New role IDs are assigned for storage incrementally, starting at ‘1’.)
The display name for a role.
A string denoting the location of an icon associated with the role.
Contains information about the role, for aiding administrators in choosing the appropriate role for a user.
An associative array of permission names to values (usually boolean) assigned to a role.
Flag for whether users assigned to a role are permitted to log in to the forum.
Flag for whether users assigned to a role are permitted to use HTML in their comments.
Flag for whether users assigned to a role are permitted to receive notification of new membership applicants.
Flag for whether a role is defining permissions for users that are not logged in.
$Role = $Context->ObjectFactory->NewContextObject($Context, 'Role');
Creates a new Role object using the given Context handle. This class will not behave properly without a valid Context.
[void] Clear()
Resets a Role object to default values, and loads the Permissions array from the Context configuration. Permission names must begin with ‘PERMISSION_’ to be included.
Before returning, this method calls the ‘DefineRolePermissions’ delegate to allow extensions to define additional permission names.
[void] FormatPropertiesForDatabaseInput()
Serializes the Permissions array and formats the strings for database insertion/update. The hardcoded permissions (those listed with the fields above) are removed from the Permissions array prior to serialization.
[void] FormatPropertiesForDisplay()
Applies the necessary formatting to display role information.
[void] GetPropertiesFromDataSet()
Populates a Role object from a database row. The Permissions array is then deserialized, and the hardcoded permissions added to it.
[void] GetPropertiesFromForm()
Reads the values posted from a role-update HTML form.
[void] AddPermission($PermissionKey)
Adds a new permission name to the list of permissions that can be granted/revoked. The value to assign to the new permission is retrieved from the Context configuration.
This delegate is called after a Role object is created, to allow new permission names to be defined (using the AddPermission method).
None.