ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTermsOfServiceUserHasGlobalRoleCriterion Class Reference

Class ilTermsOfServiceUserHasGlobalRoleCriterion. More...

+ Inheritance diagram for ilTermsOfServiceUserHasGlobalRoleCriterion:
+ Collaboration diagram for ilTermsOfServiceUserHasGlobalRoleCriterion:

Public Member Functions

 __construct (ilRbacReview $rbacReview, ilObjectDataCache $objectCache)
 ilTermsOfServiceUserHasGlobalRoleCriterion constructor. More...
 
 getTypeIdent ()
 Returns a unique id of the criterion type.
Returns
string
More...
 
 hasUniqueNature ()
 Returns whether or not a criterion is unique by it's nature.Example: "User Language". A user account can only have one profile language .

Returns
bool
More...
 
 evaluate (ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
 
Parameters
ilObjUser$user
ilTermsOfServiceCriterionConfig$config
Returns
bool
More...
 
 ui (ilLanguage $lng)
 
Parameters
ilLanguage$lng
Returns
ilTermsOfServiceCriterionTypeGUI
More...
 
 getTypeIdent ()
 Returns a unique id of the criterion type. More...
 
 hasUniqueNature ()
 Returns whether or not a criterion is unique by it's nature. More...
 
 evaluate (ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
 
 ui (ilLanguage $lng)
 

Protected Attributes

 $rbacReview
 
 $objectCache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceUserHasGlobalRoleCriterion::__construct ( ilRbacReview  $rbacReview,
ilObjectDataCache  $objectCache 
)

Member Function Documentation

◆ evaluate()

ilTermsOfServiceUserHasGlobalRoleCriterion::evaluate ( ilObjUser  $user,
ilTermsOfServiceCriterionConfig  $config 
)

Parameters
ilObjUser$user
ilTermsOfServiceCriterionConfig$config
Returns
bool

Implements ilTermsOfServiceCriterionType.

Definition at line 46 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

46 : bool
47 {
48 $roleId = $config['role_id'] ?? 0;
49
50 if (!is_numeric($roleId) || $roleId < 1 || is_float($roleId)) {
51 return false;
52 }
53
54 if (!$this->rbacReview->isGlobalRole($roleId)) {
55 return false;
56 }
57
58 $result = $this->rbacReview->isAssigned($user->getId(), $roleId);
59
60 return $result;
61 }
$result
getId()
get object id @access public
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68

References $config, $result, and ilObject\getId().

Referenced by ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationFailsIfConfiguredRoleIsNotAGlobalRole(), ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationFailsIfUserIsNotAssignedToConfiguredGlobalRole(), and ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationSucceedsIfUserIsAssignedToDefinedGlobalRole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeIdent()

ilTermsOfServiceUserHasGlobalRoleCriterion::getTypeIdent ( )

Returns a unique id of the criterion type.

Returns
string

Implements ilTermsOfServiceCriterionType.

Definition at line 30 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

30 : string
31 {
32 return 'usr_global_role';
33 }

◆ hasUniqueNature()

ilTermsOfServiceUserHasGlobalRoleCriterion::hasUniqueNature ( )

Returns whether or not a criterion is unique by it's nature.Example: "User Language". A user account can only have one profile language .

Returns
bool

Implements ilTermsOfServiceCriterionType.

Definition at line 38 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

38 : bool
39 {
40 return false;
41 }

◆ ui()

ilTermsOfServiceUserHasGlobalRoleCriterion::ui ( ilLanguage  $lng)

Parameters
ilLanguage$lng
Returns
ilTermsOfServiceCriterionTypeGUI

Implements ilTermsOfServiceCriterionType.

Definition at line 66 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

67 {
68 return new ilTermsOfServiceUserHasGlobalRoleCriterionGUI($this, $lng, $this->rbacReview, $this->objectCache);
69 }
Interface ilTermsOfServiceCriterionTypeGUI.
$lng

References $lng.

Field Documentation

◆ $objectCache

ilTermsOfServiceUserHasGlobalRoleCriterion::$objectCache
protected

Definition at line 14 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

Referenced by __construct().

◆ $rbacReview

ilTermsOfServiceUserHasGlobalRoleCriterion::$rbacReview
protected

Definition at line 11 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

Referenced by __construct().


The documentation for this class was generated from the following file: