ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 
5 include_once("./Services/ContainerReference/classes/class.ilContainerReferenceAccess.php");
6 
15 {
23  public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
24  {
25  global $DIC;
26 
27  $ilAccess = $DIC['ilAccess'];
28 
29  switch ($permission) {
30  case 'visible':
31  case 'read':
32  include_once './Modules/GroupReference/classes/class.ilObjGroupReference.php';
33  $target_ref_id = (int) ilObjGroupReference::_lookupTargetRefId($obj_id);
34 
35  if (!$target_ref_id || !$ilAccess->checkAccessOfUser($user_id, $permission, $cmd, $target_ref_id)) {
36  return false;
37  }
38  break;
39  }
40 
41  return true;
42  }
43 
62  public static function _getCommands($a_ref_id = 0): array
63  {
64  global $DIC;
65 
66  $ilAccess = $DIC['ilAccess'];
67 
68  if ($ilAccess->checkAccess('write', '', $a_ref_id)) {
69  // Only local (reference specific commands)
70  $commands = array(
71  array("permission" => "visible", "cmd" => "", "lang_var" => "show","default" => true),
72  array("permission" => "write", "cmd" => "editReference", "lang_var" => "edit")
73  );
74  } else {
75  include_once('./Modules/Group/classes/class.ilObjGroupAccess.php');
76  $commands = ilObjGroupAccess::_getCommands();
77  }
78  return $commands;
79  }
80 }
_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)