ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjRemoteLearningModuleAccess.php
Go to the documentation of this file.
1 <?php
2 
18 declare(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":
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  }
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 }
static _lookupOnline($a_obj_id)
Lookup online.
$lng
_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...
$ref_id
Definition: ltiauth.php:67
$ilUser
Definition: imgupload.php:34