ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilMDSettingsAccessService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected const string READ = 'read';
24 protected const string WRITE = 'write';
25 protected const string EDIT_PERMISSION = 'edit_permission';
26
27 protected ilAccess $access;
28 protected int $ref_id;
29
30 public function __construct(int $ref_id, ilAccess $access)
31 {
32 $this->ref_id = $ref_id;
33 $this->access = $access;
34 }
35
36 public function hasCurrentUserReadAccess(): bool
37 {
38 return $this->hasCurrentUserAccess(self::READ);
39 }
40
41 public function hasCurrentUserWriteAccess(): bool
42 {
43 return $this->hasCurrentUserAccess(self::WRITE);
44 }
45
46 public function hasCurrentUserPermissionsAccess(): bool
47 {
48 return $this->hasCurrentUserAccess(self::EDIT_PERMISSION);
49 }
50
51 protected function hasCurrentUserAccess(string $permission): bool
52 {
53 return $this->access->checkAccess($permission, '', $this->ref_id);
54 }
55}
Class ilAccessHandler Checks access for ILIAS objects.
__construct(int $ref_id, ilAccess $access)