ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BaseCheck.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
30abstract class BaseCheck implements Check
31{
32 public function __construct()
33 {
34 }
35
36 protected function hasPermission(
37 CheckHelpers $helpers,
39 Permissions ...$permission
40 ): bool {
41 if ($context->getContext() === Context::CONTEXT_WORKSPACE) {
42 foreach ($permission as $p) {
43 if ($helpers->workspace_access_handler->checkAccess(
44 $p->value,
45 '',
46 $context->getCallingId(),
47 'file'
48 )) {
49 return true;
50 }
51 }
52
53 return false;
54 }
55
56 foreach ($permission as $p) {
57 if ($helpers->access->checkAccess($p->value, '', $context->getCallingId(), 'file')) {
58 return true;
59 }
60 }
61
62 return false;
63 }
64
65 protected function hasWopiAction(CheckHelpers $helpers, string $suffix, ActionTarget ...$action): bool
66 {
67 return $helpers->action_repository->hasActionForSuffix($suffix, $action);
68 }
69
70 public function hasWopiEditAction(CheckHelpers $helpers, string $suffix): bool
71 {
72 return $helpers->action_repository->hasEditActionForSuffix($suffix);
73 }
74
75 public function hasWopiViewAction(CheckHelpers $helpers, string $suffix): bool
76 {
77 return $helpers->action_repository->hasViewActionForSuffix($suffix);
78 }
79
80 protected function baseClass(Context $context): string
81 {
82 if ($context->getContext() === Context::CONTEXT_WORKSPACE) {
83 return \ilSharedResourceGUI::class;
84 }
85 return \ilRepositoryGUI::class;
86 }
87
88}
hasWopiAction(CheckHelpers $helpers, string $suffix, ActionTarget ... $action)
Definition: BaseCheck.php:65
hasWopiViewAction(CheckHelpers $helpers, string $suffix)
Definition: BaseCheck.php:75
hasWopiEditAction(CheckHelpers $helpers, string $suffix)
Definition: BaseCheck.php:70
hasPermission(CheckHelpers $helpers, Context $context, Permissions ... $permission)
Definition: BaseCheck.php:36
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: BaseCheck.php:21
ActionTarget
Officialy supported action targets, see https://learn.microsoft.com/en-us/openspecs/office_protocols/...
if(!file_exists('../ilias.ini.php'))
$context
Definition: webdav.php:31