GroupOperations
in package
A singleton Class for doing group related functions.
Many of the Group object functions are just wrappers around these.
Tags
Table of Contents
Methods
- CheckPermission() : bool
- Test if a group has the specified permission
- DeleteGroupByID() : bool
- Given a group id, delete it from the database along with all its associations.
- get_instance() : GroupOperations
- Retrieve the single instance of this class
- GrantPermission() : mixed
- Grant a permission to a group
- InsertGroup() : int
- Given a group object, inserts it into the database.
- LoadGroupByID() : mixed
- Load a group from the database by its id
- LoadGroups() : array<string|int, mixed>
- Loads all the groups from the database and returns them
- RemovePermission() : mixed
- De-associate the specified permission with the group
- UpdateGroup() : bool
- Given a group object, update its attributes in the database.
Methods
CheckPermission()
Test if a group has the specified permission
public
CheckPermission(int $groupid, string $perm) : bool
Parameters
- $groupid : int
-
The group id
- $perm : string
-
The permission name
Return values
boolDeleteGroupByID()
Given a group id, delete it from the database along with all its associations.
public
DeleteGroupByID(int $id) : bool
Parameters
- $id : int
-
The group's id to delete
Return values
bool —True if the delete was successful. False if not.
get_instance()
Retrieve the single instance of this class
public
static & get_instance() : GroupOperations
Return values
GroupOperationsGrantPermission()
Grant a permission to a group
public
GrantPermission(int $groupid, string $perm) : mixed
Parameters
- $groupid : int
-
The group id
- $perm : string
-
The permission name
InsertGroup()
Given a group object, inserts it into the database.
public
InsertGroup(mixed $group) : int
Parameters
- $group : mixed
-
The group object to save to the database
Return values
int —The id of the newly created group. If none is created, -1
LoadGroupByID()
Load a group from the database by its id
public
& LoadGroupByID(int $id) : mixed
Parameters
- $id : int
-
The id of the group to load
Return values
mixed —The group if found. If it's not found, then false
LoadGroups()
Loads all the groups from the database and returns them
public
LoadGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of groups
RemovePermission()
De-associate the specified permission with the group
public
RemovePermission(int $groupid, string $perm) : mixed
Parameters
- $groupid : int
-
The group id
- $perm : string
-
The permission name
UpdateGroup()
Given a group object, update its attributes in the database.
public
UpdateGroup(mixed $group) : bool
Parameters
- $group : mixed
-
The group to update
Return values
bool —True if the update was successful, false if not