jAclDbUserGroup
in package
Use this class to register or unregister users in the acl system, and to manage user groups.
Works only with db driver of jAcl.
Tags
Table of Contents
- addUserToGroup() : mixed
- add a user into a group.
- createGroup() : int
- create a new group.
- createUser() : mixed
- register a user in the acl system.
- getGroupList() : array<string|int, mixed>
- return a list of group.
- getGroups() : array<string|int, mixed>
- Retrieve the list of group the current user is member of.
- getUsersList() : array<string|int, mixed>
- get the list of the users of a group.
- isMemberOfGroup() : bool
- Indicates if the current user is a member of the given user group.
- removeGroup() : mixed
- delete a group from the acl system.
- removeUser() : mixed
- unregister a user in the acl system.
- removeUserFromGroup() : mixed
- remove a user from a group.
- setDefaultGroup() : mixed
- set a group to be default (or not).
- updateGroup() : mixed
- change the name of a group.
Methods
addUserToGroup()
add a user into a group.
public
static addUserToGroup(string $login, int $groupid) : mixed
(a user can be a member of several groups)
Parameters
- $login : string
-
the user login
- $groupid : int
-
the group id
Tags
Return values
mixed —createGroup()
create a new group.
public
static createGroup(string $name) : int
Parameters
- $name : string
-
its name
Tags
Return values
int —the id of the new group
createUser()
register a user in the acl system.
public
static createUser(string $login[, bool $defaultGroup = true ]) : mixed
For example, this method is called by the acl module when responding to the event generated by the auth module when a user is created. When a user is registered, a private group is created.
Parameters
- $login : string
-
the user login
- $defaultGroup : bool = true
-
if true, the user become the member of default groups
Tags
Return values
mixed —getGroupList()
return a list of group.
public
static getGroupList([string $login = '' ]) : array<string|int, mixed>
if a login is given, it returns only the groups of the user. Else it returns all groups (except private groups)
Parameters
- $login : string = ''
-
an optional login
Tags
Return values
array<string|int, mixed> —a list of groups object (dao records)
getGroups()
Retrieve the list of group the current user is member of.
public
static getGroups() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —list of group id
getUsersList()
get the list of the users of a group.
public
static getUsersList(int $groupid) : array<string|int, mixed>
Parameters
- $groupid : int
-
id of the user group
Tags
Return values
array<string|int, mixed> —a list of users object (dao records)
isMemberOfGroup()
Indicates if the current user is a member of the given user group.
public
static isMemberOfGroup(int $groupid) : bool
Parameters
- $groupid : int
-
The id of a group
Tags
Return values
bool —true if it's ok
removeGroup()
delete a group from the acl system.
public
static removeGroup(int $groupid) : mixed
Parameters
- $groupid : int
-
the group id
Tags
Return values
mixed —removeUser()
unregister a user in the acl system.
public
static removeUser(string $login) : mixed
Parameters
- $login : string
-
the user login
Tags
Return values
mixed —removeUserFromGroup()
remove a user from a group.
public
static removeUserFromGroup(string $login, int $groupid) : mixed
Parameters
- $login : string
-
the user login
- $groupid : int
-
the group id
Tags
Return values
mixed —setDefaultGroup()
set a group to be default (or not).
public
static setDefaultGroup(int $groupid[, bool $default = true ]) : mixed
there can have several default group. A default group is a group where a user is assigned to during its registration
Parameters
- $groupid : int
-
the group id
- $default : bool = true
-
true if the group is to be default, else false
Tags
Return values
mixed —updateGroup()
change the name of a group.
public
static updateGroup(int $groupid, string $name) : mixed
Parameters
- $groupid : int
-
the group id
- $name : string
-
the new name