ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilObjRemoteGlossaryAccess.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
32 {
37  public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
38  {
39  global $ilUser, $lng, $rbacsystem, $ilAccess;
40 
41  if (is_null($user_id)) {
42  $user_id = $ilUser->getId();
43  }
44 
45  switch ($permission) {
46  case "visible":
47  $active = ilObjRemoteGlossary::_lookupOnline($obj_id);
48  $tutor = $rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
49 
50  if (!$active) {
51  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
52  }
53  if (!$tutor and !$active) {
54  return false;
55  }
56  break;
57 
58  case 'read':
59  $tutor = $rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id);
60  if ($tutor) {
61  return true;
62  }
63  $active = ilObjRemoteGlossary::_lookupOnline($obj_id);
64 
65  if (!$active) {
66  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
67  return false;
68  }
69  break;
70  }
71  return true;
72  }
73 
86  public static function _getCommands(): array
87  {
88  $commands = array(
89  array("permission" => "read", "cmd" => "show", "lang_var" => "info",
90  "default" => true),
91  array("permission" => "write", "cmd" => "edit", "lang_var" => "edit")
92  );
93 
94  return $commands;
95  }
96 }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
global $lng
Definition: privfeed.php:31
_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.