ILIAS  release_8 Revision v8.24
class.ilObjRemoteCourseAccess.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
31{
37
38 public function __construct()
39 {
40 global $DIC;
41
42 $this->logger = $DIC->logger()->rcrs();
43 $this->ilAccess = $DIC->access();
44 $this->ilUser = $DIC->user();
45 $this->lng = $DIC->language();
46 $this->rbacsystem = $DIC->rbac()->system();
47 }
52 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
53 {
54 $this->logger->debug('>' . $cmd . '< >' . $permission . '< >' . $ref_id . '< >' . $obj_id . '< >' . $user_id . '<');
55 if (is_null($user_id)) {
56 $user_id = $this->ilUser->getId();
57 }
58
59 switch ($permission) {
60 case "visible":
61 $active = ilObjRemoteCourse::_lookupOnline($obj_id);
62 $tutor = $this->rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
63
64 if (!$active) {
65 $this->ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
66 }
67 if (!$tutor and !$active) {
68 return false;
69 }
70 break;
71
72 case 'read':
73 $tutor = $this->rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
74 if ($tutor) {
75 return true;
76 }
77 $active = ilObjRemoteCourse::_lookupOnline($obj_id);
78
79 if (!$active) {
80 $this->ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
81 return false;
82 }
83 break;
84 }
85 return true;
86 }
87
88
101 public static function _getCommands(): array
102 {
103 $commands = array(
104 array("permission" => "read", "cmd" => "show", "lang_var" => "info",
105 "default" => true),
106 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit")
107 );
108
109 return $commands;
110 }
111}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addInfoItem(string $a_type, string $a_text, string $a_data="")
add an info item to current info object
language handling
Component logger with individual log levels by component id.
_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 _lookupOnline($a_obj_id)
Lookup online.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67