ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTermsOfServiceUserHasGlobalRoleCriterion.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
11  protected $rbacReview;
12 
14  protected $objectCache;
15 
22  {
23  $this->rbacReview = $rbacReview;
24  $this->objectCache = $objectCache;
25  }
26 
30  public function getTypeIdent() : string
31  {
32  return 'usr_global_role';
33  }
34 
38  public function hasUniqueNature() : bool
39  {
40  return false;
41  }
42 
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  }
62 
67  {
68  return new \ilTermsOfServiceUserHasGlobalRoleCriterionGUI($this, $lng, $this->rbacReview, $this->objectCache);
69  }
70 }
getTypeIdent()
Returns a unique id of the criterion type.string
Interface ilTermsOfServiceCriterionTypeGUI.
$config
Definition: bootstrap.php:15
$result
Interface ilTermsOfServiceCriterionType.
hasUniqueNature()
Returns whether or not a criterion is unique by it&#39;s nature.Example: "User Language". A user account can only have one profile language . bool
Class ilTermsOfServiceCriterionConfig.
class ilObjectDataCache
evaluate(\ilObjUser $user, \ilTermsOfServiceCriterionConfig $config)
bool
getId()
get object id public
$lng
__construct(\ilRbacReview $rbacReview, \ilObjectDataCache $objectCache)
ilTermsOfServiceUserHasGlobalRoleCriterion constructor.
$user
Definition: migrateto20.php:57
language handling
class ilRbacReview Contains Review functions of core Rbac.