ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilIndividualAssessmentAccessHandler Class Reference

Deal with ilias rbac-system More...

+ Inheritance diagram for ilIndividualAssessmentAccessHandler:
+ Collaboration diagram for ilIndividualAssessmentAccessHandler:

Public Member Functions

 __construct (ilObjIndividualAssessment $iass, ilAccessHandler $handler, ilRbacAdmin $admin, ilRbacReview $review, ilObjUser $usr)
 
 checkAccessToObj ($operation)
 Can an user perform an operation on some Individual assessment?
Parameters
string$operation
Returns
bool
More...
 
 initDefaultRolesForObject (ilObjIndividualAssessment $iass)
 Create default roles at an object.
Parameters
ilObjIndividualAssessment$iass
More...
 
 assignUserToMemberRole (ilObjUser $usr, ilObjIndividualAssessment $iass)
 Assign a user to the member role at an Individual assessment.
Parameters
ilObjIndividualAssessment$iass
ilObjUser$usr
More...
 
 deassignUserFromMemberRole (ilObjUser $usr, ilObjIndividualAssessment $iass)
 Deasign a user from the member role at an Individual assessment.
Parameters
ilObjIndividualAssessment$iass
ilObjUser$usr
More...
 
 mayViewObject ($use_cache=true)
 User view iass object. More...
 
 mayEditObject ($use_cache=true)
 User edit iass. More...
 
 mayEditPermissions ($use_cache=true)
 User edit permissions. More...
 
 mayEditMembers ($use_cache=true)
 User may edit members. More...
 
 mayViewUser ($use_cache=true)
 User may view gradings. More...
 
 mayGradeUser ($use_cache=true)
 User may grade. More...
 
 mayGradeUserById ($a_user_id)
 User may grade. More...
 
 filterViewableOrGradeableUsers (array $a_user_ids)
 Filter out users that may be graded or viewed. More...
 
 mayAmendGradeUser ($use_cache=true)
 User may Amend grading. More...
 
 isSystemAdmin ()
 Check whether user is system admin. More...
 

Data Fields

const DEFAULT_ROLE = 'il_iass_member'
 

Protected Member Functions

 getRoleTitleByObj (ilObjIndividualAssessment $iass)
 
 getMemberRoleIdForObj (ilObjIndividualAssessment $iass)
 
 cacheCheckAccessToObj ($operation)
 Get permission state from cache. More...
 

Protected Attributes

 $iass
 
 $handler
 
 $admin
 
 $review
 ilRbacReview More...
 
 $user
 
 $mass_global_permissions_cache
 

Detailed Description

Deal with ilias rbac-system

Definition at line 8 of file class.ilIndividualAssessmentAccessHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilIndividualAssessmentAccessHandler::__construct ( ilObjIndividualAssessment  $iass,
ilAccessHandler  $handler,
ilRbacAdmin  $admin,
ilRbacReview  $review,
ilObjUser  $usr 
)

Definition at line 42 of file class.ilIndividualAssessmentAccessHandler.php.

References $admin, $handler, $iass, and $review.

43  {
44  $this->iass = $iass;
45  $this->handler = $handler;
46  $this->admin = $admin;
47  $this->review = $review;
48  $this->usr = $usr;
49  $this->mass_global_permissions_cache = array();
50  }

Member Function Documentation

◆ assignUserToMemberRole()

ilIndividualAssessmentAccessHandler::assignUserToMemberRole ( ilObjUser  $usr,
ilObjIndividualAssessment  $iass 
)

Assign a user to the member role at an Individual assessment.

Parameters
ilObjIndividualAssessment$iass
ilObjUser$usr

Implements IndividualAssessmentAccessHandler.

Definition at line 83 of file class.ilIndividualAssessmentAccessHandler.php.

References ilObject\getId(), and getMemberRoleIdForObj().

84  {
85  return $this->admin->assignUser($this->getMemberRoleIdForObj($iass), $usr->getId());
86  }
getId()
get object id public
+ Here is the call graph for this function:

◆ cacheCheckAccessToObj()

ilIndividualAssessmentAccessHandler::cacheCheckAccessToObj (   $operation)
protected

Get permission state from cache.

Parameters
string$operation
Returns
bool

Definition at line 268 of file class.ilIndividualAssessmentAccessHandler.php.

References checkAccessToObj().

Referenced by mayAmendGradeUser(), mayEditMembers(), mayEditObject(), mayEditPermissions(), mayGradeUser(), mayViewObject(), and mayViewUser().

269  {
270  $iass_id = $this->iass->getId();
271  $user_id = $this->usr->getId();
272 
273  if (!isset($this->mass_global_permissions_cache[$iass_id][$user_id][$operation])) {
274  $this->mass_global_permissions_cache[$iass_id][$user_id][$operation]
275  = $this->checkAccessToObj($operation);
276  }
277 
278  return $this->mass_global_permissions_cache[$iass_id][$user_id][$operation];
279  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessToObj()

ilIndividualAssessmentAccessHandler::checkAccessToObj (   $operation)

Can an user perform an operation on some Individual assessment?

Parameters
string$operation
Returns
bool

Implements IndividualAssessmentAccessHandler.

Definition at line 55 of file class.ilIndividualAssessmentAccessHandler.php.

Referenced by cacheCheckAccessToObj(), mayAmendGradeUser(), mayEditMembers(), mayEditObject(), mayEditPermissions(), mayGradeUser(), mayViewObject(), and mayViewUser().

56  {
57  if ($operation == "read_learning_progress") {
58  return $this->handler->checkRbacOrPositionPermissionAccess("read_learning_progress", "read_learning_progress", $this->iass->getRefId());
59  }
60  if ($operation == "edit_learning_progress") {
61  return $this->handler->checkRbacOrPositionPermissionAccess("edit_learning_progress", "write_learning_progress", $this->iass->getRefId());
62  }
63 
64  return $this->handler->checkAccessOfUser($this->usr->getId(), $operation, '', $this->iass->getRefId(), 'iass');
65  }
+ Here is the caller graph for this function:

◆ deassignUserFromMemberRole()

ilIndividualAssessmentAccessHandler::deassignUserFromMemberRole ( ilObjUser  $usr,
ilObjIndividualAssessment  $iass 
)

Deasign a user from the member role at an Individual assessment.

Parameters
ilObjIndividualAssessment$iass
ilObjUser$usr

Implements IndividualAssessmentAccessHandler.

Definition at line 91 of file class.ilIndividualAssessmentAccessHandler.php.

References ilObject\getId(), and getMemberRoleIdForObj().

92  {
93  return $this->admin->deassignUser($this->getMemberRoleIdForObj($iass), $usr->getId());
94  }
getId()
get object id public
+ Here is the call graph for this function:

◆ filterViewableOrGradeableUsers()

ilIndividualAssessmentAccessHandler::filterViewableOrGradeableUsers ( array  $a_user_ids)

Filter out users that may be graded or viewed.

Parameters
int[]$a_user_ids
Returns
int[] $a_user_ids

Definition at line 221 of file class.ilIndividualAssessmentAccessHandler.php.

References ilOrgUnitGlobalSettings\getInstance().

221  : array
222  {
223  $usr_id = $this->usr->getId();
224  $obj_id = $this->iass->getId();
225  $ref_id = $this->iass->getRefId();
226  if (
227  $this->handler->checkAccessOfUser($usr_id, "edit_members", '', $ref_id, 'iass')
228  || $this->handler->checkAccessOfUser($usr_id, "read_learning_progress", '', $ref_id, 'iass')
229  || $this->handler->checkAccessOfUser($usr_id, "write_learning_progress", '', $ref_id, 'iass')
230  ) {
231  return $a_user_ids;
232  }
233 
234  $orgu_settings = ilOrgUnitGlobalSettings::getInstance();
235  if (!$orgu_settings->isPositionAccessActiveForObject($obj_id)) {
236  return [];
237  }
238 
239  $viewable_users = $this->handler->filterUserIdsByPositionOfCurrentUser("read_learning_progress", $ref_id, $a_user_ids);
240  $gradeable_users = $this->handler->filterUserIdsByPositionOfCurrentUser("write_learning_progress", $ref_id, $a_user_ids);
241 
242  return array_unique(array_merge($viewable_users, $gradeable_users));
243  }
+ Here is the call graph for this function:

◆ getMemberRoleIdForObj()

ilIndividualAssessmentAccessHandler::getMemberRoleIdForObj ( ilObjIndividualAssessment  $iass)
protected

Definition at line 101 of file class.ilIndividualAssessmentAccessHandler.php.

References ilObject\getRefId().

Referenced by assignUserToMemberRole(), and deassignUserFromMemberRole().

102  {
103  return current($this->review->getLocalRoles($iass->getRefId()));
104  }
getRefId()
get reference id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoleTitleByObj()

ilIndividualAssessmentAccessHandler::getRoleTitleByObj ( ilObjIndividualAssessment  $iass)
protected

Definition at line 96 of file class.ilIndividualAssessmentAccessHandler.php.

References ilObject\getRefId().

Referenced by initDefaultRolesForObject().

97  {
98  return self::DEFAULT_ROLE . '_' . $iass->getRefId();
99  }
getRefId()
get reference id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initDefaultRolesForObject()

ilIndividualAssessmentAccessHandler::initDefaultRolesForObject ( ilObjIndividualAssessment  $iass)

Create default roles at an object.

Parameters
ilObjIndividualAssessment$iass

Implements IndividualAssessmentAccessHandler.

Definition at line 70 of file class.ilIndividualAssessmentAccessHandler.php.

References ilObjRole\createDefaultRole(), ilObject\getId(), ilObject\getRefId(), and getRoleTitleByObj().

71  {
73  $this->getRoleTitleByObj($iass),
74  "Admin of iass obj_no." . $iass->getId(),
75  self::DEFAULT_ROLE,
76  $iass->getRefId()
77  );
78  }
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
getId()
get object id public
getRefId()
get reference id public
+ Here is the call graph for this function:

◆ isSystemAdmin()

ilIndividualAssessmentAccessHandler::isSystemAdmin ( )

Check whether user is system admin.

Returns
bool

Implements IndividualAssessmentAccessHandler.

Definition at line 286 of file class.ilIndividualAssessmentAccessHandler.php.

Referenced by mayEditMembers(), mayEditObject(), mayEditPermissions(), mayGradeUser(), mayGradeUserById(), mayViewObject(), and mayViewUser().

287  {
288  return $this->review->isAssigned($this->usr->getId(), SYSTEM_ROLE_ID);
289  }
+ Here is the caller graph for this function:

◆ mayAmendGradeUser()

ilIndividualAssessmentAccessHandler::mayAmendGradeUser (   $use_cache = true)

User may Amend grading.

Parameters
bool$use_cache
Returns
bool

Definition at line 252 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), and checkAccessToObj().

253  {
254  if ($use_cache) {
255  return $this->cacheCheckAccessToObj('amend_grading');
256  }
257 
258  return $this->checkAccessToObj('amend_grading');
259  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:

◆ mayEditMembers()

ilIndividualAssessmentAccessHandler::mayEditMembers (   $use_cache = true)

User may edit members.

Parameters
bool$use_cache
Returns
bool

Definition at line 161 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), checkAccessToObj(), and isSystemAdmin().

162  {
163  if ($use_cache) {
164  return $this->cacheCheckAccessToObj('edit_members');
165  }
166 
167  return $this->isSystemAdmin() || $this->checkAccessToObj('edit_members');
168  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:

◆ mayEditObject()

ilIndividualAssessmentAccessHandler::mayEditObject (   $use_cache = true)

User edit iass.

Parameters
bool$use_cache
Returns
bool

Definition at line 129 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), checkAccessToObj(), and isSystemAdmin().

130  {
131  if ($use_cache) {
132  return $this->cacheCheckAccessToObj('write');
133  }
134 
135  return $this->isSystemAdmin() || $this->checkAccessToObj('write');
136  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:

◆ mayEditPermissions()

ilIndividualAssessmentAccessHandler::mayEditPermissions (   $use_cache = true)

User edit permissions.

Parameters
bool$use_cache
Returns
bool

Definition at line 145 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), checkAccessToObj(), and isSystemAdmin().

146  {
147  if ($use_cache) {
148  return $this->cacheCheckAccessToObj('edit_permission');
149  }
150 
151  return $this->isSystemAdmin() || $this->checkAccessToObj('edit_permission');
152  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:

◆ mayGradeUser()

ilIndividualAssessmentAccessHandler::mayGradeUser (   $use_cache = true)

User may grade.

Parameters
bool$use_cache
Returns
bool

Definition at line 193 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), checkAccessToObj(), and isSystemAdmin().

Referenced by mayGradeUserById().

194  {
195  if ($use_cache) {
196  return $this->cacheCheckAccessToObj('edit_learning_progress');
197  }
198 
199  return $this->isSystemAdmin() || $this->checkAccessToObj('edit_learning_progress');
200  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mayGradeUserById()

ilIndividualAssessmentAccessHandler::mayGradeUserById (   $a_user_id)

User may grade.

Parameters
int$a_user_id
Returns
bool

Definition at line 209 of file class.ilIndividualAssessmentAccessHandler.php.

References isSystemAdmin(), and mayGradeUser().

210  {
211  return $this->isSystemAdmin()
212  || ($this->mayGradeUser() && count($this->handler->filterUserIdsByRbacOrPositionOfCurrentUser("edit_learning_progress", "set_lp", $this->iass->getRefId(), [$a_user_id])) > 0);
213  }
+ Here is the call graph for this function:

◆ mayViewObject()

ilIndividualAssessmentAccessHandler::mayViewObject (   $use_cache = true)

User view iass object.

Parameters
bool$use_cache
Returns
bool

Definition at line 113 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), checkAccessToObj(), and isSystemAdmin().

114  {
115  if ($use_cache) {
116  return $this->cacheCheckAccessToObj('read');
117  }
118 
119  return $this->isSystemAdmin() || $this->checkAccessToObj('read');
120  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:

◆ mayViewUser()

ilIndividualAssessmentAccessHandler::mayViewUser (   $use_cache = true)

User may view gradings.

Parameters
bool$use_cache
Returns
bool

Definition at line 177 of file class.ilIndividualAssessmentAccessHandler.php.

References cacheCheckAccessToObj(), checkAccessToObj(), and isSystemAdmin().

178  {
179  if ($use_cache) {
180  return $this->cacheCheckAccessToObj('read_learning_progress');
181  }
182 
183  return $this->isSystemAdmin() || $this->checkAccessToObj('read_learning_progress');
184  }
checkAccessToObj($operation)
Can an user perform an operation on some Individual assessment?bool
cacheCheckAccessToObj($operation)
Get permission state from cache.
+ Here is the call graph for this function:

Field Documentation

◆ $admin

ilIndividualAssessmentAccessHandler::$admin
protected

Definition at line 23 of file class.ilIndividualAssessmentAccessHandler.php.

Referenced by __construct().

◆ $handler

ilIndividualAssessmentAccessHandler::$handler
protected

Definition at line 18 of file class.ilIndividualAssessmentAccessHandler.php.

Referenced by __construct().

◆ $iass

ilIndividualAssessmentAccessHandler::$iass
protected

Definition at line 13 of file class.ilIndividualAssessmentAccessHandler.php.

Referenced by __construct().

◆ $mass_global_permissions_cache

ilIndividualAssessmentAccessHandler::$mass_global_permissions_cache
protected

◆ $review

ilIndividualAssessmentAccessHandler::$review
protected

ilRbacReview

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

Referenced by __construct().

◆ $user

ilIndividualAssessmentAccessHandler::$user
protected

◆ DEFAULT_ROLE

const ilIndividualAssessmentAccessHandler::DEFAULT_ROLE = 'il_iass_member'

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