ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilObjGroupReferenceAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
21  public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
22  {
23  global $DIC;
24 
25  $ilAccess = $DIC['ilAccess'];
26 
27  switch ($permission) {
28  case 'visible':
29  case 'read':
30  $target_ref_id = (int) ilObjGroupReference::_lookupTargetRefId($obj_id);
31 
32  if (!$target_ref_id || !$ilAccess->checkAccessOfUser($user_id, $permission, $cmd, $target_ref_id)) {
33  return false;
34  }
35  break;
36  }
37 
38  return true;
39  }
40 
59  public static function _getCommands($a_ref_id = 0): array
60  {
61  global $DIC;
62 
63  $ilAccess = $DIC['ilAccess'];
64 
65  if ($ilAccess->checkAccess('write', '', $a_ref_id)) {
66  // Only local (reference specific commands)
67  $commands = array(
68  array("permission" => "visible", "cmd" => "", "lang_var" => "show","default" => true),
69  array("permission" => "write", "cmd" => "editReference", "lang_var" => "edit")
70  );
71  } else {
72  $commands = ilObjGroupAccess::_getCommands();
73  }
74  return $commands;
75  }
76 }
_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 _getCommands($a_ref_id=0)
get commands
$ref_id
Definition: ltiauth.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:25
static _lookupTargetRefId(int $a_obj_id)