ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
More...
 

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.

References $result, and ilObject\getId().

Referenced by ilTermsOfServiceUserHasGlobalRoleCriterionTest\testEvaluationFailsIfConfiguredRoleDoesNotMatchTheExpectedFormat().

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  }
$config
Definition: bootstrap.php:15
$result
$user
Definition: migrateto20.php:57
+ 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.

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

30  : string
31  {
32  return 'usr_global_role';
33  }
+ 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 38 of file class.ilTermsOfServiceUserHasGlobalRoleCriterion.php.

38  : bool
39  {
40  return false;
41  }

◆ ui()

ilTermsOfServiceUserHasGlobalRoleCriterion::ui ( \ilLanguage  $lng)

Parameters
\ilLanguage$lng
Returns

Implements ilTermsOfServiceCriterionType.

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

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

67  {
68  return new \ilTermsOfServiceUserHasGlobalRoleCriterionGUI($this, $lng, $this->rbacReview, $this->objectCache);
69  }
Interface ilTermsOfServiceCriterionTypeGUI.
$lng
+ Here is the caller graph for this function:

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: