ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ForcedInfo.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
31 class ForcedInfo extends Info implements Check
32 {
33  #[\Override]
34  public function canUnlock(): Capabilities
35  {
36  return Capabilities::FORCED_INFO_PAGE;
37  }
38 
39  #[\Override]
40  public function maybeUnlock(
41  Capability $capability,
42  CheckHelpers $helpers,
43  \ilObjFileInfo $info,
45  ): Capability {
46  $force_info_page = !$info->shouldDownloadDirectly();
47  if ($force_info_page) {
48  return $capability->withUnlocked(true);
49 
50  return $capability->withUnlocked(
51  $this->hasPermission(
52  $helpers,
53  $context,
54  Permissions::VISIBLE,
55  Permissions::READ,
56  Permissions::WRITE,
57  Permissions::VIEW_CONTENT,
58  Permissions::EDIT_CONTENT
59  )
60  );
61  }
62 
63  return $capability->withUnlocked(false);
64  }
65 }
$context
Definition: webdav.php:31
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
maybeUnlock(Capability $capability, CheckHelpers $helpers, \ilObjFileInfo $info, Context $context,)
Definition: ForcedInfo.php:40