ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjCourseReferenceAccess.php
Go to the documentation of this file.
1<?php
2
29{
33 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
34 {
35 global $DIC;
36
37 switch ($permission) {
38 case 'visible':
39 case 'read':
40 $target_ref_id = ilObjCourseReference::_lookupTargetRefId($obj_id);
41
42 if (!$target_ref_id || !$DIC->access()->checkAccessOfUser($user_id, $permission, $cmd, $target_ref_id)) {
43 return false;
44 }
45 break;
46 }
47
48 return true;
49 }
50
54 public static function _preloadData(array $obj_ids, array $ref_ids): void
55 {
56 global $DIC;
57
58 $repository = new ilUserCertificateRepository();
59 $coursePreload = new ilCertificateObjectsForUserPreloader($repository);
60 $coursePreload->preLoad($DIC->user()->getId(), array_map(function ($objId) {
62 }, $obj_ids));
63 }
64
68 public static function _getCommands($a_ref_id = 0): array
69 {
70 global $DIC;
71
72 if ($DIC->access()->checkAccess('write', '', $a_ref_id)) {
73 // Only local (reference specific commands)
74 $commands = array(
75 array("permission" => "visible", "cmd" => "", "lang_var" => "show","default" => true),
76 array("permission" => "write", "cmd" => "editReference", "lang_var" => "edit")
77 );
78 } else {
80 }
81 return $commands;
82 }
83}
static _lookupTargetId(int $a_obj_id)
static _lookupTargetRefId(int $a_obj_id)
static _getCommands()
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _preloadData(array $obj_ids, array $ref_ids)
Preload data.
_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:66
global $DIC
Definition: shib_login.php:26
$objId
Definition: xapitoken.php:57