Jelix 1.8.14-pre

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
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|jDaoRecordBase
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, object>
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.
renameUser()  : mixed
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.

Tags

GROUPTYPE_PRIVATE

Group type in the grouptype field.

public mixed GROUPTYPE_PRIVATE = 2

Indicates that the group belongs to a unique User.

Tags

Properties

$groups

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

list of groups of the current user

Tags

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

Tags
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

Tags
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

Tags
Return values
mixed

getGroupList()

Return a list of group.

public static getGroupList([string $login = '' ][, mixed $withAnonymous = false ]) : 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

$withAnonymous : mixed = false
Tags
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>
Tags
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, object>
Parameters
$groupid : string

id of the user group

Tags
Return values
array<string|int, object>

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

Tags
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

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, string $groupid) : mixed
Parameters
$login : string

the user login

$groupid : string

the group id

Tags
Return values
mixed

renameUser()

public static renameUser(mixed $oldLogin, mixed $newLogin) : mixed
Parameters
$oldLogin : mixed
$newLogin : mixed
Tags
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

Tags
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

Tags
Return values
mixed

Search results