Jelix 1.7.18

jAcl2DbUserGroup
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 jAcl2.

Tags
subpackage

acl

static

Table of Contents

GROUPTYPE_DEFAULT  = 1
Group type in the grouptype field.
GROUPTYPE_NORMAL  = 0
Group type in the grouptype field.
GROUPTYPE_PRIVATE  = 2
Group type in the grouptype field.
$groups  : null|array<string|int, string>
addUserToGroup()  : mixed
Add a user into a group.
clearCache()  : mixed
Clear cache of variables of this class.
createGroup()  : string
Create a new group.
createUser()  : mixed
register a user in the acl system.
getGroup()  : false|jacl2group
Get a group.
getGroupList()  : jDbResultSet
Return a list of group.
getGroups()  : array<string|int, mixed>
Retrieve the list of group the current user is member of.
getGroupsIdByUser()  : array<string|int, mixed>
Retrieve the list of group the given user is member of.
getPrivateGroup()  : string
Get the private group for the current user or for the given login.
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.

Constants

GROUPTYPE_DEFAULT

Group type in the grouptype field.

public mixed GROUPTYPE_DEFAULT = 1

Indicates that the group is the default one for new users.

GROUPTYPE_PRIVATE

Group type in the grouptype field.

public mixed GROUPTYPE_PRIVATE = 2

Indicates that the group belongs to a unique User.

Properties

$groups

protected static null|array<string|int, string> $groups

list of groups of the current user

Methods

addUserToGroup()

Add a user into a group.

public static addUserToGroup(string $login, string $groupid) : mixed

(a user can be a member of several groups)

Parameters
$login : string

the user login

$groupid : string

the group id

Return values
mixed

clearCache()

Clear cache of variables of this class.

public static clearCache() : mixed
Tags
since
1.3
Return values
mixed

createGroup()

Create a new group.

public static createGroup(string $name[, string $id_aclgrp = null ]) : string
Parameters
$name : string

its name

$id_aclgrp : string = null

its id

Return values
string

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

Return values
mixed

getGroup()

Get a group.

public static getGroup(string $code) : false|jacl2group
Parameters
$code : string

The code

Tags
since
1.2
Return values
false|jacl2group

the dao object r false if it doesn't exist

getGroupList()

Return a list of group.

public static getGroupList([string $login = '' ]) : jDbResultSet

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

Return values
jDbResultSet

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>
Return values
array<string|int, mixed>

list of group id

getGroupsIdByUser()

Retrieve the list of group the given user is member of.

public static getGroupsIdByUser(string $login) : array<string|int, mixed>
Parameters
$login : string

The user's login

Tags
since
1.6.29
Return values
array<string|int, mixed>

list of group id

getPrivateGroup()

Get the private group for the current user or for the given login.

public static getPrivateGroup([string $login = null ]) : string
Parameters
$login : string = null

The user's login

Tags
since
1.2
Return values
string

the id of the private group

getUsersList()

get the list of the users of a group.

public static getUsersList(string $groupid) : array<string|int, mixed>
Parameters
$groupid : string

id of the user group

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(string $groupid) : bool
Parameters
$groupid : string

The id of a group

Return values
bool

true if it's ok

removeGroup()

delete a group from the acl system.

public static removeGroup(string $groupid) : mixed
Parameters
$groupid : string

the group id

Return values
mixed

removeUser()

Unregister a user in the acl system.

public static removeUser(string $login) : mixed
Parameters
$login : string

the user login

Return values
mixed

removeUserFromGroup()

Remove a user from a group.

public static removeUserFromGroup(string $login, string $groupid) : mixed
Parameters
$login : string

the user login

$groupid : string

the group id

Return values
mixed

setDefaultGroup()

Set a group to be default (or not).

public static setDefaultGroup(string $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 : string

the group id

$default : bool = true

true if the group is to be default, else false

Return values
mixed

updateGroup()

Change the name of a group.

public static updateGroup(string $groupid, string $name) : mixed
Parameters
$groupid : string

the group id

$name : string

the new name

Return values
mixed

Search results