ILIAS  release_8 Revision v8.23
ilTermsOfServiceUserHasGlobalRoleCriterion Class Reference

Class ilTermsOfServiceUserHasGlobalRoleCriterion. More...

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

Public Member Functions

 __construct (ilRbacReview $rbacReview, ilObjectDataCache $objectCache)
 
 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

ilRbacReview $rbacReview
 
ilObjectDataCache $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.

References ilObject\getId(), and ILIAS\Repository\int().

Referenced by ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationFailsIfConfiguredRoleDoesNotMatchTheExpectedFormat().

46  : bool
47  {
48  $roleId = $config['role_id'] ?? 0;
49 
50  if (!is_numeric($roleId) || $roleId < 1 || $roleId > PHP_INT_MAX || is_float($roleId)) {
51  return false;
52  }
53 
54  if (!$this->rbacReview->isGlobalRole((int) $roleId)) {
55  return false;
56  }
57 
58  return $this->rbacReview->isAssigned($user->getId(), (int) $roleId);
59  }
+ 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 36 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

Referenced by ilTermsOfServiceUserHasGlobalRoleCriterionTest\testFormUserInterfaceElementsAreProperlyBuilt(), and ilTermsOfServiceUserHasGlobalRoleCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved().

36  : string
37  {
38  return 'usr_global_role';
39  }
+ Here is the caller graph for this function:

◆ 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 41 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

41  : bool
42  {
43  return false;
44  }

◆ ui()

Field Documentation

◆ $objectCache

ilObjectDataCache ilTermsOfServiceUserHasGlobalRoleCriterion::$objectCache
protected

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

Referenced by __construct().

◆ $rbacReview

ilRbacReview ilTermsOfServiceUserHasGlobalRoleCriterion::$rbacReview
protected

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

Referenced by __construct().


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