1 <?php declare(strict_types = 1);
29 'rp_visible' =>
'visible',
31 'rp_write' =>
'write',
32 'rp_manage_members' =>
'manage_members' 65 public function may(
string $operation) : bool
68 if (in_array($operation, self::ORGU_OPERATIONS)) {
70 $this->access->checkAccess(
71 self::ROLEMAPPINGS[self::ROLEPERM_MANAGE_MEMBERS],
77 return $this->access->checkAccess(self::ROLEMAPPINGS[$operation],
'', $this->
getProgrammeRefId());
84 public function mayAnyOf(array $operations) : bool
86 foreach ($operations as $operation) {
87 if ($this->
may($operation)) {
101 if ($this->
may(self::ROLEPERM_MANAGE_MEMBERS)) {
105 if (in_array($operation, self::ORGU_OPERATIONS) && $this->
may($operation)) {
116 if ($this->
may(self::ROLEPERM_MANAGE_MEMBERS)) {
120 return $this->orgu_access->filterUserIdsByPositionOfCurrentUser(
130 self::ORGU_OPERATIONS,
134 self::ROLEPERM_WRITE,
135 self::ROLEPERM_MANAGE_MEMBERS
139 if (!in_array($operation,
$valid)) {
140 throw new \ilException(
'prg does not provide this permission: ' . $operation);
146 if (!$this->cache[$orgu_operation]) {
147 $user_ids = array_map(
149 $this->orgu_access->filterUserIdsByPositionOfCurrentUser(
151 $this->getProgrammeRefId(),
155 $this->cache[$orgu_operation] = array_unique($user_ids);
157 return $this->cache[$orgu_operation];
165 if (!$this->cache[self::ROLEPERM_MANAGE_MEMBERS]) {
166 $this->cache[self::ROLEPERM_MANAGE_MEMBERS] = array_unique($this->programme->getMembers());
168 return $this->cache[self::ROLEPERM_MANAGE_MEMBERS];
173 return (
int) $this->programme->getRefId();
const OP_VIEW_INDIVIDUAL_PLAN
getUserIdsInPrgAccessibleForOperation(string $orgu_operation)
Class ilOrgUnitPositionAccess.
__construct(ilAccess $access, ilOrgUnitPositionAccess $orgu_access, ilObjStudyProgramme $programme)
const OP_EDIT_INDIVIDUAL_PLAN
const OP_READ_LEARNING_PROGRESS
mayAnyOf(array $operations)
Both role and OrgU-based permissions are relevant in many places of the PRG.
getUserIdsSusceptibleTo(string $operation)
return int[]
const ROLEPERM_MANAGE_MEMBERS
filterUserIds(array $user_ids, string $operation)
throwForInvalidOperation(string $operation)