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