package CONTENIDO Core
subpackage Permission

 Methods

Returns all groups of a user

getGroupsForUser(string $userId) : array

Parameters

$userId

string

Returns

arrayList of group ids

Returns the id of an action.

getIDForAction(string | int $action) : int

If passed action is numeric, it will returned directly.

Parameters

$action

stringint

Returns

int

Returns the id of an area.

getIDForArea(string | int $area) : int

If passed area is numeric, it will returned directly.

Parameters

$area

stringint

Returns

int

getParentAreaId()

getParentAreaId($area) 

Parameters

$area

Checks if a user has access rights for a specific client.

hasClientPermission(int $iClient, object $oUser) : bool

Parameters

$iClient

int

idclient to check, or false for the current client

$oUser

object

User object to check against, or false for the current user

Returns

bool

Checks if user has permissions tp passed perm.

have_perm(string $p) : bool
  • Sysadmin has allways permission
  • Client admin has allways permission

Parameters

$p

string

Permissions (comma separated list of perms) to check

Returns

bool

have_perm_area_action()

have_perm_area_action($area, $action) 

Parameters

$area

$action

have_perm_area_action_anyitem()

have_perm_area_action_anyitem($area, $action) 

Parameters

$area

$action

have_perm_area_action_item()

have_perm_area_action_item($area, $action, $itemid) 

Parameters

$area

$action

$itemid

have_perm_client()

have_perm_client($p) 

Parameters

$p

have_perm_client_lang()

have_perm_client_lang($client, $lang) 

Parameters

$client

$lang

Checks if an item have any perms

have_perm_item(string | int $mainarea, int $itemid) : bool

Parameters

$mainarea

stringint

$itemid

int

Returns

bool

Checks if the given user has an admin permission

isClientAdmin(integer $iClient, object $oUser) : bool

Parameters

$iClient

integer

idclient to check

$oUser

object

User object to check against

Returns

bool

Checks if the given group has access permission for a client

isClientGroup(int $iClient, object $oGroup) : bool

Parameters

$iClient

int

idclient to check

$oGroup

object

Group object to check against

Returns

bool

Checks if the given user has access permission for a client

isClientUser(int $iClient, object $oUser) : bool

Parameters

$iClient

int

idclient to check

$oUser

object

User object to check against

Returns

bool

Checks if the given user has sysadmin permission

isSysadmin(object $oUser) 

Parameters

$oUser

object

User object to check against

Loads all permissions of groups where current logged in user is a member and saves them in session.

load_permissions(bool $force) : string

Parameters

$force

bool

Flag to force loading, event if they were ccached before

Returns

stringReturns diffrent values, depending on state: '1' (string) if permissions couldn't loaded '3' (string) if permissions were successfull loaded

Loads all permissions for a specific user or group.

load_permissions_for_user(string $user) 

Stores area rights in global variable $area_rights. Stores item rights in global variable $item_rights.

Parameters

$user

string

User Id hash

showareas()

showareas($mainarea) 

Parameters

$mainarea

Checks if the given object is a user object.

_checkUserObject(object $oUser) : object

If oUser is false, initialize the object from the currently logged in user. If oUser is not an object of the class cApiUser, throw an exception.

Parameters

$oUser

object

User object

Exceptions

\cInvalidArgumentException if the given or constructed user is not a cApiUser object

Returns

object

 Properties

 

$actioncache : array
 

$areacache : array
 

$classname : string
 

$db : \cDb