ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjQuestionPoolAccess.php
Go to the documentation of this file.
1<?php
2
29{
34
35 public function __construct()
36 {
37 global $DIC;
38 $this->current_user = $DIC['ilUser'];
39 $this->lng = $DIC['lng'];
40 $this->rbacsystem = $DIC['rbacsystem'];
41 $this->access = $DIC['ilAccess'];
42 ;
43 }
56 public static function _getCommands(): array
57 {
58 $commands = [
59 ["permission" => "write", "cmd" => "questions", "lang_var" => "tst_edit_questions"],
60 ["permission" => "write", "cmd" => "ilObjQuestionPoolSettingsGeneralGUI::showForm", "lang_var" => "settings"],
61 #array("permission" => "write", "cmd" => "questions", "lang_var" => "edit",
62 # "default" => false),
63 ["permission" => "read", "cmd" => "questions", "lang_var" => "edit",
64 "default" => true]
65 ];
66
67 return $commands;
68 }
69
70 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
71 {
72 if (is_null($user_id)) {
73 $user_id = $this->current_user->getId();
74 }
75
76 if ($this->rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) {
77 return true;
78 }
79
80 switch ($permission) {
81 case 'visible':
82 case 'read':
83 if (self::_isOffline($obj_id)) {
84 $this->access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("tst_warning_pool_offline"));
85 return false;
86 }
87 break;
88 }
89
90 return true;
91 }
92}
Class ilAccessHandler Checks access for ILIAS objects.
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcc...
User class.
Class ilObjectAccess.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26