ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Survey\Access\AccessManager Class Reference
+ Collaboration diagram for ILIAS\Survey\Access\AccessManager:

Public Member Functions

 __construct (InternalDomainService $domain_service, \ilAccessHandler $access, int $ref_id, int $user_id)
 
 canRead ()
 
 canManageCodes ()
 
 canAccessInfoScreen ()
 Can access info screen: This is possible for external raters, or users with read or visible permission. More...
 
 canStartSurvey ()
 Can start the survey This is possible for external raters, or users with read or visible permission Note: This is true before entering the code, the code is not checked yet. More...
 
 canEditSettings ()
 
 canAccessEvaluation ()
 Can access evaluation. More...
 
 isCodeInputAllowed ()
 Is it possible to take the survey by providing an access code? More...
 
 canReadResultOfParticipants (?array $a_finished_ids=null)
 Gets all participants or a subset of participants (by run ids) where the current user can access the results. More...
 

Protected Member Functions

 getSurvey ()
 
 checkRbacOrPositionPermission (string $a_rbac_permission, string $a_position_permission)
 

Protected Attributes

ilAccessHandler $access
 
int $ref_id
 
int $user_id
 
InternalDomainService $domain_service
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Access\AccessManager::__construct ( InternalDomainService  $domain_service,
\ilAccessHandler  $access,
int  $ref_id,
int  $user_id 
)

Member Function Documentation

◆ canAccessEvaluation()

ILIAS\Survey\Access\AccessManager::canAccessEvaluation ( )

Can access evaluation.

Definition at line 125 of file class.AccessManager.php.

References ILIAS\Survey\Access\AccessManager\$user_id, ilObjSurveyAccess\_hasEvaluationAccess(), ILIAS\Repository\access(), ILIAS\Survey\Access\AccessManager\checkRbacOrPositionPermission(), and ILIAS\Survey\Access\AccessManager\getSurvey().

125  : bool
126  {
127  $survey = $this->getSurvey();
128  if ($this->access->checkAccessOfUser($this->user_id, "write", "", $this->ref_id) ||
129  $this->checkRbacOrPositionPermission('read_results', 'access_results') ||
131  return true;
132  }
133  return false;
134  }
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
checkRbacOrPositionPermission(string $a_rbac_permission, string $a_position_permission)
+ Here is the call graph for this function:

◆ canAccessInfoScreen()

ILIAS\Survey\Access\AccessManager::canAccessInfoScreen ( )

Can access info screen: This is possible for external raters, or users with read or visible permission.

Definition at line 82 of file class.AccessManager.php.

References ILIAS\Repository\access(), and ILIAS\Survey\Access\AccessManager\getSurvey().

82  : bool
83  {
84  $participant_status = $this->domain_service
85  ->participants()
86  ->status($this->getSurvey(), $this->user_id);
87  if ($participant_status->isExternalRater() ||
88  $this->access->checkAccessOfUser($this->user_id, "read", "", $this->ref_id) ||
89  $this->access->checkAccessOfUser($this->user_id, "visible", "", $this->ref_id)) {
90  return true;
91  }
92  return false;
93  }
+ Here is the call graph for this function:

◆ canEditSettings()

ILIAS\Survey\Access\AccessManager::canEditSettings ( )

Definition at line 117 of file class.AccessManager.php.

References ILIAS\Repository\access().

117  : bool
118  {
119  return $this->access->checkAccessOfUser($this->user_id, "write", "", $this->ref_id);
120  }
+ Here is the call graph for this function:

◆ canManageCodes()

ILIAS\Survey\Access\AccessManager::canManageCodes ( )

Definition at line 62 of file class.AccessManager.php.

References ILIAS\Repository\access().

62  : bool
63  {
64  return $this->access->checkAccessOfUser(
65  $this->user_id,
66  "write",
67  "",
68  $this->ref_id
69  ) ||
70  $this->access->checkAccessOfUser( // see #35369
71  $this->user_id,
72  "delete",
73  "",
74  $this->ref_id
75  );
76  }
+ Here is the call graph for this function:

◆ canRead()

ILIAS\Survey\Access\AccessManager::canRead ( )

Definition at line 52 of file class.AccessManager.php.

References ILIAS\Repository\access().

52  : bool
53  {
54  return $this->access->checkAccessOfUser(
55  $this->user_id,
56  "read",
57  "",
58  $this->ref_id
59  );
60  }
+ Here is the call graph for this function:

◆ canReadResultOfParticipants()

ILIAS\Survey\Access\AccessManager::canReadResultOfParticipants ( ?array  $a_finished_ids = null)

Gets all participants or a subset of participants (by run ids) where the current user can access the results.

Definition at line 168 of file class.AccessManager.php.

References ILIAS\Repository\access(), and ILIAS\Survey\Access\AccessManager\getSurvey().

170  : array {
171  $all_participants = $this->getSurvey()->getSurveyParticipants($a_finished_ids);
172  $participant_ids = [];
173  foreach ($all_participants as $participant) {
174  if (isset($participant['usr_id'])) {
175  $participant_ids[] = $participant['usr_id'];
176  }
177  }
178 
179  $filtered_participant_ids = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
180  'read_results',
181  'access_results',
182  $this->getSurvey()->getRefId(),
183  $participant_ids
184  );
185  $participants = [];
186  foreach ($all_participants as $username => $user_data) {
187  if (!isset($user_data['usr_id'])) {
188  $participants[$username] = $user_data;
189  }
190  if (in_array(($user_data['usr_id'] ?? null), $filtered_participant_ids)) {
191  $participants[$username] = $user_data;
192  }
193  }
194  return $participants;
195  }
+ Here is the call graph for this function:

◆ canStartSurvey()

ILIAS\Survey\Access\AccessManager::canStartSurvey ( )

Can start the survey This is possible for external raters, or users with read or visible permission Note: This is true before entering the code, the code is not checked yet.

Definition at line 100 of file class.AccessManager.php.

References ILIAS\Repository\access(), and ILIAS\Survey\Access\AccessManager\getSurvey().

100  : bool
101  {
102  $survey = $this->getSurvey();
103  $participant_status = $this->domain_service
104  ->participants()
105  ->status($survey, $this->user_id);
106  if ($participant_status->isExternalRater() ||
107  $this->access->checkAccessOfUser($this->user_id, "read", "", $this->ref_id)) {
108  if (!$survey->getOfflineStatus() &&
109  $survey->hasStarted() &&
110  !$survey->hasEnded()) {
111  return true;
112  }
113  }
114  return false;
115  }
+ Here is the call graph for this function:

◆ checkRbacOrPositionPermission()

ILIAS\Survey\Access\AccessManager::checkRbacOrPositionPermission ( string  $a_rbac_permission,
string  $a_position_permission 
)
protected

Definition at line 136 of file class.AccessManager.php.

References ILIAS\Survey\Access\AccessManager\$access, and ilOrgUnitPositionAndRBACAccessHandler\checkRbacOrPositionPermissionAccess().

Referenced by ILIAS\Survey\Access\AccessManager\canAccessEvaluation().

139  : bool {
142  $a_rbac_permission,
143  $a_position_permission,
144  $this->ref_id
145  );
146  }
checkRbacOrPositionPermissionAccess(string $rbac_perm, string $pos_perm, int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSurvey()

ILIAS\Survey\Access\AccessManager::getSurvey ( )
protected

◆ isCodeInputAllowed()

ILIAS\Survey\Access\AccessManager::isCodeInputAllowed ( )

Is it possible to take the survey by providing an access code?

Definition at line 151 of file class.AccessManager.php.

References ILIAS\Survey\Access\AccessManager\getSurvey().

151  : bool
152  {
153  $survey = $this->getSurvey();
154  $participant_status = $this->domain_service
155  ->participants()
156  ->status($this->getSurvey(), $this->user_id);
157  if ($participant_status->isExternalRater() ||
158  $survey->getAnonymize() || !$survey->isAccessibleWithoutCode()) {
159  return true;
160  }
161  return false;
162  }
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ILIAS\Survey\Access\AccessManager::$access
protected

◆ $domain_service

InternalDomainService ILIAS\Survey\Access\AccessManager::$domain_service
protected

◆ $ref_id

int ILIAS\Survey\Access\AccessManager::$ref_id
protected

◆ $user_id

int ILIAS\Survey\Access\AccessManager::$user_id
protected

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