36 $this->
user = $DIC->user();
37 $this->
lng = $DIC->language();
38 $this->rbacsystem = $DIC->rbac()->system();
39 $this->
access = $DIC->access();
50 public static function checkCondition(
int $a_trigger_obj_id,
string $a_operator,
string $a_value,
int $a_usr_id): bool
52 switch ($a_operator) {
54 if (self::_lookupFinished($a_trigger_obj_id, $a_usr_id)) {
66 public function _checkAccess(
string $cmd,
string $permission,
int $ref_id,
int $obj_id, ?
int $user_id = null): bool
73 if (is_null($user_id)) {
79 switch ($permission) {
82 if (!self::_lookupCreationComplete($obj_id) &&
92 if (!self::_lookupCreationComplete($obj_id)) {
99 if (!self::_lookupCreationComplete($obj_id)) {
103 if ($rbacsystem->
checkAccess(
"write", $ref_id) || self::_hasEvaluationAccess($obj_id, $user_id)) {
118 array(
"permission" =>
"read",
"cmd" =>
"infoScreen",
"lang_var" =>
"svy_run",
"default" =>
true),
119 array(
"permission" =>
"write",
"cmd" =>
"questions",
"lang_var" =>
"edit_questions"),
120 array(
"permission" =>
"write",
"cmd" =>
"properties",
"lang_var" =>
"settings"),
121 array(
"permission" =>
"read",
"cmd" =>
"evaluation",
"lang_var" =>
"svy_results")
138 $ilDB = $DIC->database();
140 $result =
$ilDB->queryF(
141 "SELECT * FROM svy_svy WHERE obj_fi=%s",
147 if ($result->numRows() === 1) {
148 $row =
$ilDB->fetchAssoc($result);
150 if (is_null($row) || !$row[
"complete"]) {
163 $ilDB = $DIC->database();
165 $result =
$ilDB->queryF(
166 "SELECT * FROM svy_svy WHERE obj_fi=%s",
170 if ($result->numRows() === 1) {
171 $row =
$ilDB->fetchAssoc($result);
172 return (
int) $row[
"evaluation_access"];
183 $ilDB = $DIC->database();
185 $result =
$ilDB->queryF(
186 "SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
187 array(
'integer',
'integer'),
188 array($user_id, $survey_id)
190 return $result->numRows() === 1;
198 $ilDB = $DIC->database();
200 $result =
$ilDB->queryF(
201 "SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
205 if ($result->numRows() === 1) {
206 $row =
$ilDB->fetchAssoc($result);
207 return (
bool) $row[
"anonymize"];
217 $evaluation_access = self::_lookupEvaluationAccess($a_obj_id);
218 $svy_mode = self::_lookupMode($a_obj_id);
223 switch ($svy->get360Results()) {
235 switch ($evaluation_access) {
247 switch ($svy->get360Results()) {
252 return $svy->isAppraiseeClosed($user_id);
255 return $svy->isAppraisee($user_id);
262 switch ($svy->get360Results()) {
270 return $svy->isAppraisee($user_id);
277 switch ($svy->getSelfEvaluationResults()) {
291 if (self::_lookupAnonymize($a_obj_id)) {
297 $ilDB = $DIC->database();
298 $result =
$ilDB->queryF(
299 "SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
303 if ($result->numRows() === 1) {
304 $row =
$ilDB->fetchAssoc($result);
306 if (self::_isSurveyParticipant($user_id, $row[
"survey_id"])) {
328 $ilDB = $DIC->database();
332 if ($a_user_id === 0) {
336 $result =
$ilDB->queryF(
337 "SELECT * FROM svy_svy WHERE obj_fi = %s",
341 if ($result->numRows() === 1) {
342 $row =
$ilDB->fetchObject($result);
343 if ((
int) $row->anonymize === 1) {
344 $result =
$ilDB->queryF(
345 "SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s " .
346 "AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s " .
347 "AND svy_anonymous.survey_key = svy_finished.anonymous_id",
348 array(
'integer',
'text'),
349 array($row->survey_id, md5($a_user_id))
352 $result =
$ilDB->queryF(
353 "SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
354 array(
'integer',
'integer'),
355 array($row->survey_id, $a_user_id)
358 if ($result->numRows() === 1) {
359 $foundrow =
$ilDB->fetchAssoc($result);
360 $finished = (
int) $foundrow[
"state"];
374 $ilDB = $DIC->database();
376 $result =
$ilDB->queryF(
377 "SELECT mode FROM svy_svy" .
378 " WHERE obj_fi = %s",
383 if ($result->numRows() === 1) {
384 $row =
$ilDB->fetchAssoc($result);
385 return (
int) $row[
"mode"];
396 $ilDB = $DIC->database();
398 $result =
$ilDB->queryF(
399 "SELECT mode FROM svy_svy" .
400 " WHERE obj_fi = %s AND mode = %s",
401 array(
'integer',
'integer'),
404 return (
bool)
$ilDB->numRows($result);
414 $request = $DIC->survey()
420 $ilAccess = $DIC->access();
422 $t_arr = explode(
"_", $target);
423 if ($t_arr[0] !==
"svy" || ((
int) $t_arr[1]) <= 0) {
428 $access_code = ($request->getAccessCode() !==
"")
429 ? $request->getAccessCode()
431 if ($access_code !==
"") {
433 $run_manager = $DIC->survey()->internal()->domain()->execution()->run($survey, $DIC->user()->getId());
435 $run_manager->initSession($access_code);
439 if (ilObjSurvey::validateExternalRaterCode((
int) $t_arr[1], $access_code)) {
444 if ($ilAccess->checkAccess(
"visible",
"", $t_arr[1]) ||
445 $ilAccess->checkAccess(
"read",
"", $t_arr[1])) {
static _lookupEvaluationAccess(int $a_obj_id)
get evaluation access
const IL_NO_OBJECT_ACCESS
static _isSurveyParticipant(int $user_id, int $survey_id)
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition for a specific user and object
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _checkGoto(string $target)
check whether goto script will succeed
static _lookupAnonymize(int $a_obj_id)
static _lookupFinished(int $a_obj_id, int $a_user_id=0)
get finished status
Interface for condition handling.
static getConditionOperators()
Returns an array with valid operators for the specific object type.
checkAccessOfUser(int $a_user_id, string $a_operations, int $a_ref_id, string $a_type="")
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
static _lookupMode(int $a_obj_id)
Get survey mode (see ilObjSurvey::MODE_...
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const RESULTS_SELF_EVAL_NONE
static _lookupCreationComplete(int $a_obj_id)
checks whether all necessary parts of the survey are given
static _lookup360Mode(int $a_obj_id)