Jelix 1.8.13

jAcl2DbManager
in package

This class is used to manage rights. Works only with db driver of jAcl2.

Tags
static

Table of Contents

ACL_ADMIN_RIGHTS_NOT_ASSIGNED  = 1
ACL_ADMIN_RIGHTS_SESSION_USER_LOOSE_THEM  = 2
ACL_ADMIN_RIGHTS_STILL_USED  = 0
$ACL_ADMIN_RIGHTS  : mixed
addRight()  : bool
add a right on the given users group/resource.
addRole()  : mixed
create a new right.
addRoleGroup()  : mixed
Create a new right group.
addSubject()  : mixed
create a new right.
addSubjectGroup()  : mixed
Create a new right group.
checkAclAdminAuthorizationsChanges()  : int
Checks if given authorizations changes still allow to administrate rights for at least one user.
checkAclAdminRightsToAddUserIntoGroup()  : int
check if the adding of the given user to the the given group still allows to administrate rights for at least one user.
checkAclAdminRightsToRemoveGroup()  : int
check if the removing of the given group still allows to administrate rights for at least one user.
checkAclAdminRightsToRemoveUser()  : int
check if the removing of the given user still allow to administrate authorizations for at least one user.
checkAclAdminRightsToRemoveUserFromGroup()  : int
check if the removing of the given user from a the given group still allows to administrate rights for at least one user.
copyRightSettings()  : mixed
Set a right to users groups which have the given right.
copyRoleRights()  : mixed
Set a right to users groups which have the given right.
createRight()  : mixed
create a new right.
createRightGroup()  : mixed
Create a new right group.
deleteRight()  : mixed
Delete the given right.
deleteRightGroup()  : mixed
Delete the given right group.
removeResourceRight()  : mixed
remove the right on the given resource, for all users groups.
removeRight()  : mixed
remove a right on the given users group/resource. The given right for this users group will then inherit from other groups if the user is in multiple groups of users.
removeRole()  : mixed
Delete the given right.
removeRoleGroup()  : mixed
Delete the given right group.
removeSubject()  : mixed
Delete the given right.
removeSubjectGroup()  : mixed
Delete the right group.
setRightsOnGroup()  : mixed
Set all rights on the given users group.

Constants

ACL_ADMIN_RIGHTS_SESSION_USER_LOOSE_THEM

public mixed ACL_ADMIN_RIGHTS_SESSION_USER_LOOSE_THEM = 2
Tags

Properties

$ACL_ADMIN_RIGHTS

public static mixed $ACL_ADMIN_RIGHTS = array('acl.group.view', 'acl.group.modify', 'acl.group.delete', 'acl.user.view', 'acl.user.modify')
Tags

Methods

addRight()

add a right on the given users group/resource.

public static addRight(string $group, string $right[, string $resource = '-' ]) : bool
Parameters
$group : string

the users group id

$right : string

the key of the right

$resource : string = '-'

the id of a resource

Tags
Return values
bool

true if the right is set

addRole()

create a new right.

public static addRole(string $right, string $label_key[, string $rightsGroup = null ]) : mixed
Parameters
$right : string

the key of the right

$label_key : string

the key of a locale which represents the label of the right

$rightsGroup : string = null

the id of the rights group where the right is attached to

Tags
deprecated
see
createRight()
since
1.7
Return values
mixed

addRoleGroup()

Create a new right group.

public static addRoleGroup(string $rightGroup, string $label_key) : mixed
Parameters
$rightGroup : string

the key of the right group

$label_key : string

the key of a locale which represents the label of the right group

Tags
deprecated

see createRightGroup()

since
1.7
Return values
mixed

addSubject()

create a new right.

public static addSubject(string $right, string $label_key[, string $rightsGroup = null ]) : mixed
Parameters
$right : string

the key of the right

$label_key : string

the key of a locale which represents the label of the right

$rightsGroup : string = null

the id of the rights group where the right is attached to

Tags
deprecated
see
createRight()
Return values
mixed

addSubjectGroup()

Create a new right group.

public static addSubjectGroup(string $rightGroup, string $label_key) : mixed
Parameters
$rightGroup : string

the key of the right group

$label_key : string

the key of a locale which represents the label of the right group

Tags
since
1.3
deprecated

see createRightGroup()

Return values
mixed

checkAclAdminAuthorizationsChanges()

Checks if given authorizations changes still allow to administrate rights for at least one user.

public static checkAclAdminAuthorizationsChanges(array<string|int, mixed> $authorizationsChanges, string $sessionUser, int $changeType) : int

For each groups, only authorizations on given rights are considered changed. Other existing authorizations are considered as deleted.

Authorizations with resources are not changed.

Parameters
$authorizationsChanges : array<string|int, mixed>

array(<id_aclgrp> => array( <id_aclsbj> => false(inherit)/''(inherit)/true(add)/'y'(add)/'n'(remove)))

$sessionUser : string

the login name of the user who initiate the change

$changeType : int

1 for group rights change, 2 for user rights change

Tags
Return values
int

one of the jAcl2DbAdminCheckAuthorizations::ACL_ADMIN_RIGHTS_* const

checkAclAdminRightsToAddUserIntoGroup()

check if the adding of the given user to the the given group still allows to administrate rights for at least one user.

public static checkAclAdminRightsToAddUserIntoGroup(string $userToAdd, string $groupInWhichToAddAUser, string $sessionUser) : int

(because the group may forbid to administrate rights.)

Parameters
$userToAdd : string

the user login

$groupInWhichToAddAUser : string

the group id

$sessionUser : string

the login name of the user who initiate the change

Tags
Return values
int

one of ACL_ADMIN_RIGHTS_* constant

checkAclAdminRightsToRemoveGroup()

check if the removing of the given group still allows to administrate rights for at least one user.

public static checkAclAdminRightsToRemoveGroup(string $groupToRemove, string $sessionUser) : int
Parameters
$groupToRemove : string

the group id to remove

$sessionUser : string

the login name of the user who initiate the change

Tags
Return values
int

one of ACL_ADMIN_RIGHTS_* constant

checkAclAdminRightsToRemoveUser()

check if the removing of the given user still allow to administrate authorizations for at least one user.

public static checkAclAdminRightsToRemoveUser(string $userToRemove[, string $sessionUser = null ]) : int
Parameters
$userToRemove : string
$sessionUser : string = null

the login name of the user who initiate the change

Tags
Return values
int

one of ACL_ADMIN_RIGHTS_* constant

checkAclAdminRightsToRemoveUserFromGroup()

check if the removing of the given user from a the given group still allows to administrate rights for at least one user.

public static checkAclAdminRightsToRemoveUserFromGroup(string $userToRemoveFromTheGroup, string $groupFromWhichToRemoveTheUser, string $sessionUser) : int
Parameters
$userToRemoveFromTheGroup : string
$groupFromWhichToRemoveTheUser : string
$sessionUser : string

the login name of the user who initiate the change

Tags
Return values
int

one of ACL_ADMIN_RIGHTS_* constant

copyRightSettings()

Set a right to users groups which have the given right.

public static copyRightSettings(string $sourceRight, mixed $targetRight) : mixed

It can be useful when creating a new right.

Parameters
$sourceRight : string

the right that users groups have

$targetRight : mixed

the right to set on users groups having $sourceRight

Tags
since
1.7.6
Return values
mixed

copyRoleRights()

Set a right to users groups which have the given right.

public static copyRoleRights(string $sourceRight, mixed $targetRight) : mixed

It can be useful when creating a new right.

Parameters
$sourceRight : string

the right that users groups have

$targetRight : mixed

the right to set on users groups having $sourceRight

Tags
deprecated
see
copyRightSettings()
Return values
mixed

createRight()

create a new right.

public static createRight(string $right, string $label_key[, string $rightsGroup = null ]) : mixed
Parameters
$right : string

the key of the right

$label_key : string

the key of a locale which represents the label of the right

$rightsGroup : string = null

the id of the rights group where the right is attached to

Tags
since
1.7.6
Return values
mixed

createRightGroup()

Create a new right group.

public static createRightGroup(string $rightGroup, string $label_key) : mixed
Parameters
$rightGroup : string

the key of the right group

$label_key : string

the key of a locale which represents the label of the right group

Tags
since
1.7.6
Return values
mixed

deleteRight()

Delete the given right.

public static deleteRight(string $right) : mixed

It is deleted from the database, so it is not usable anymore.

Parameters
$right : string

the key of the right

Tags
since
1.7.6
Return values
mixed

deleteRightGroup()

Delete the given right group.

public static deleteRightGroup(string $rightGroup) : mixed
Parameters
$rightGroup : string

the key of the right group

Tags
since
1.7
Return values
mixed

removeResourceRight()

remove the right on the given resource, for all users groups.

public static removeResourceRight(string $right, string $resource) : mixed
Parameters
$right : string

the key of the right

$resource : string

the id of a resource

Tags
Return values
mixed

removeRight()

remove a right on the given users group/resource. The given right for this users group will then inherit from other groups if the user is in multiple groups of users.

public static removeRight(string $group, string $right[, string $resource = '-' ][, bool $canceled = false ]) : mixed
Parameters
$group : string

the users group id

$right : string

the key of the right

$resource : string = '-'

the id of a resource

$canceled : bool = false

true if the removing is to cancel a right, instead of an inheritance

Tags
Return values
mixed

removeRole()

Delete the given right.

public static removeRole(string $right) : mixed
Parameters
$right : string

the key of the right

Tags
deprecated
see
deleteRight()
since
1.7
Return values
mixed

removeRoleGroup()

Delete the given right group.

public static removeRoleGroup(string $rightGroup) : mixed
Parameters
$rightGroup : string

the key of the right group

Tags
since
1.7
deprecated

see deleteRightGroup

Return values
mixed

removeSubject()

Delete the given right.

public static removeSubject(string $right) : mixed
Parameters
$right : string

the key of the right

Tags
deprecated
see
deleteRight()
Return values
mixed

removeSubjectGroup()

Delete the right group.

public static removeSubjectGroup(string $rightGroup) : mixed
Parameters
$rightGroup : string

the key of the right group

Tags
since
1.3
deprecated

see deleteRightGroup

Return values
mixed

setRightsOnGroup()

Set all rights on the given users group.

public static setRightsOnGroup(string $group, array<string|int, mixed> $rights) : mixed

Only given rights are changed. Existing rights not given in parameters are deleted from the group (i.e: marked as inherited).

Rights with resources are not changed.

Parameters
$group : string

the users group id

$rights : array<string|int, mixed>

list of rights key=right key, value=false(inherit)/''(inherit)/true(add)/'y'(add)/'n'(remove)

Tags
Return values
mixed

Search results