ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Capabilities.php
Go to the documentation of this file.
1 <?php
2 
23 
24 enum Capabilities: string
25 {
26  case EDIT_EXTERNAL = 'editExternal';
27  case INFO_PAGE = 'showSummary';
28  case FORCED_INFO_PAGE = 'showSummaryForced';
29  case MANAGE_VERSIONS = 'versions';
30  case EDIT_SETTINGS = 'edit';
31  case UNZIP = 'unzipCurrentRevision';
32  case DOWNLOAD = 'sendfile';
33  case VIEW_EXTERNAL = 'viewExternal';
34  case NONE = 'none';
35 
36  public static function fromName(string $name): Capabilities
37  {
38  foreach (self::cases() as $case) {
39  if ($name === $case->name) {
40  return $case;
41  }
42  }
43  return self::NONE;
44  }
45 
46  public static function fromCommand(string $cmd): Capabilities
47  {
48  foreach (self::cases() as $case) {
49  if ($cmd === $case->value) {
50  return $case;
51  }
52  }
53  return self::NONE;
54  }
55 
56 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...