ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjMediaPoolAccess.php
Go to the documentation of this file.
1<?php
2
20{
23 protected ilLanguage $lng;
24 protected ilObjUser $user;
25
26 public function __construct()
27 {
28 global $DIC;
29
30 $this->user = $DIC->user();
31 $this->lng = $DIC->language();
32 $this->rbacsystem = $DIC->rbac()->system();
33 $this->access = $DIC->access();
34 }
35
36 public static function _getCommands(): array
37 {
38 $commands = array(
39 array("permission" => "read", "cmd" => "", "lang_var" => "show",
40 "default" => true),
41 array("permission" => "write", "cmd" => "", "lang_var" => "edit_content",
42 "default" => false),
43 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings",
44 "default" => false)
45 );
46
47 return $commands;
48 }
49
53 public static function _checkGoto(string $target): bool
54 {
55 global $DIC;
56
57 $ilAccess = $DIC->access();
58
59 $t_arr = explode("_", $target);
60
61 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
62 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
63 return true;
64 }
65 return false;
66 }
67
68 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
69 {
70 if (is_null($user_id)) {
71 $user_id = $this->user->getId();
72 }
73
74 switch ($permission) {
75 case "read":
76 case "visible":
77 if (self::_isOffline($obj_id) &&
78 (!$this->rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id))) {
79 $this->access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
80 return false;
81 }
82 break;
83 }
84 return true;
85 }
86
87}
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...
static _checkGoto(string $target)
check whether goto script will succeed
static _getCommands()
get commands
User class.
Class ilObjectAccess.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26