ILIAS  release_8 Revision v8.24
class.ilObjRemoteWikiAccess.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
31{
36 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
37 {
38 global $ilUser, $lng, $rbacsystem, $ilAccess;
39
40 if (is_null($user_id)) {
41 $user_id = $ilUser->getId();
42 }
43
44 switch ($permission) {
45 case "visible":
46 $active = ilObjRemoteWiki::_lookupOnline($obj_id);
47 $tutor = $rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
48
49 if (!$active) {
50 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
51 }
52 if (!$tutor and !$active) {
53 return false;
54 }
55 break;
56
57 case 'read':
58 $tutor = $rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
59 if ($tutor) {
60 return true;
61 }
62 $active = ilObjRemoteWiki::_lookupOnline($obj_id);
63
64 if (!$active) {
65 $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
66 return false;
67 }
68 break;
69 }
70 return true;
71 }
72
85 public static function _getCommands(): array
86 {
87 $commands = array(
88 array("permission" => "read", "cmd" => "show", "lang_var" => "info",
89 "default" => true),
90 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit")
91 );
92
93 return $commands;
94 }
95}
_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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:34
$ref_id
Definition: ltiauth.php:67
$lng