ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjGroupReferenceAccess.php
Go to the documentation of this file.
1 <?php
2 
19 include_once("./Services/ContainerReference/classes/class.ilContainerReferenceAccess.php");
20 
29 {
37  public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
38  {
39  global $DIC;
40 
41  $ilAccess = $DIC['ilAccess'];
42 
43  switch ($permission) {
44  case 'visible':
45  case 'read':
46  include_once './Modules/GroupReference/classes/class.ilObjGroupReference.php';
47  $target_ref_id = (int) ilObjGroupReference::_lookupTargetRefId($obj_id);
48 
49  if (!$ilAccess->checkAccessOfUser($user_id, $permission, $cmd, $target_ref_id)) {
50  return false;
51  }
52  break;
53  }
54 
55  return true;
56  }
57 
76  public static function _getCommands($a_ref_id = 0): array
77  {
78  global $DIC;
79 
80  $ilAccess = $DIC['ilAccess'];
81 
82  if ($ilAccess->checkAccess('write', '', $a_ref_id)) {
83  // Only local (reference specific commands)
84  $commands = array(
85  array("permission" => "visible", "cmd" => "", "lang_var" => "show","default" => true),
86  array("permission" => "write", "cmd" => "editReference", "lang_var" => "edit")
87  );
88  } else {
89  include_once('./Modules/Group/classes/class.ilObjGroupAccess.php');
90  $commands = ilObjGroupAccess::_getCommands();
91  }
92  return $commands;
93  }
94 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
_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
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTargetRefId(int $a_obj_id)