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