ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
RBACAccessCheckLegacyProxy.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\WebDAV;
22
25
30{
31 public function hasCurrentUserAccess(Action $action, ?int $ref_id = null): bool
32 {
33 if ($ref_id === null) {
34 return false;
35 }
36 try {
37 global $DIC;
38
39 $access = $DIC->access();
40 if ($access === null) {
41 return false;
42 }
43
44 $user = $DIC->user();
45
46 return $access->checkAccessOfUser($user->getId(), $action->value, '', $ref_id);
47 } catch (\Throwable $e) {
48 return false;
49 }
50 }
51
52 public function canUserCreate(Type $type, ?int $ref_id = null): bool
53 {
54 if ($ref_id === null) {
55 return false;
56 }
57 try {
58 global $DIC;
59
60 $access = $DIC->access();
61 if ($access === null) {
62 return false;
63 }
64
65 $user = $DIC->user();
66
67 return $access->checkAccessOfUser($user->getId(), Action::CREATE->value . '_' . $type->value, '', $ref_id);
68 } catch (\Throwable $e) {
69 return false;
70 }
71
72 return false;
73 }
74}
hasCurrentUserAccess(Action $action, ?int $ref_id=null)
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26