Class RolesRights
- TableAccess
-
RolesRights
License: GNU General Public License v2.0 only **********************************************************************************************
Brief:
Manages a special right of the table adm_roles_rights for a special object.
This class will manage roles rights for a specific object. The possible rights are defined within the table adm_roles_rights. The assigned roles will be stored within the table adm_roles_rights_data. There is also the link to the specific object. The assigned roles of the object could be managed with this class. You can add or remove roles and check if a user has access to the specific right.
Class: RolesRights
Code:
// check if the current user has the right to view a folder of the download module $folderViewRolesObject = new RolesRights($gDb, 'folder_view', $folderId); if($folderViewRolesObject->hasRight($gCurrentUser->getRoleMemberships())) { // do something } @endcode
Code:
// add new roles to the special roles right of a folder $folderViewRolesObject = new RolesRights($gDb, 'folder_view', $folderId); $folderViewRolesObject->addRoles(array(2, 5)); @endcode
Par: Examples
Located at rolesrights.php
Methods summary
public
|
#
__construct(
Constructor that will create an object of a recordset of the table adm_roles_rights. If the id is set than the specific category will be loaded. |
public
|
|
public
boolean
|
|
public
|
|
public
boolean
|
|
public
int[]
|
#
getRolesIds( )
Get all roles ids that where assigned to the current roles right and the selected object. |
protected
boolean
|
#
readData( string $sqlWhereCondition )
Reads a record out of the table in database selected by the conditions of the param @b $sqlWhereCondition out of the table. If the sql will find more than one record the method returns @b false. Per default all columns of the default table will be read and stored in the object. |
public
|
#
removeRoles( array $roleIds )
Remove all roles of the parameter array from the current roles rights object. |
Methods inherited from TableAccess
__sleep(),
connectAdditionalTable(),
countAllRecords(),
getValue(),
hasColumnsValueChanged(),
isNewRecord(),
readDataByColumns(),
readDataById(),
save(),
setArray(),
setDatabase(),
setValue()
Properties summary
protected
|
$rolesRightsDataObjects
|
|
protected
|
$rolesIds
|
|
protected
|
$objectId
|
|
protected
|
$rolesRightName
|
Properties inherited from TableAccess
$additionalTables,
$columnPrefix,
$columnsInfos,
$columnsValueChanged,
$db,
$dbColumns,
$keyColumnName,
$new_record,
$tableName