ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilUDFPermissionHelper.php
Go to the documentation of this file.
1 <?php
2 
24 {
25  public const CONTEXT_UDF = 1;
26  public const CONTEXT_FIELD = 2;
27 
28  public const ACTION_UDF_CREATE_FIELD = 1;
29 
30  public const ACTION_FIELD_EDIT = 1;
31  public const ACTION_FIELD_DELETE = 2;
32  public const ACTION_FIELD_EDIT_PROPERTY = 3;
33  public const ACTION_FIELD_EDIT_ACCESS = 4;
34 
35  public const SUBACTION_FIELD_TITLE = 1;
36  public const SUBACTION_FIELD_PROPERTIES = 2;
37 
50 
51  // caching
52 
53  protected function readContextIds(int $a_context_type): array // Missing array type.
54  {
55  global $DIC;
56 
57  $ilDB = $DIC['ilDB'];
58 
59  switch ($a_context_type) {
60  case self::CONTEXT_UDF:
61  return [$this->getRefId()];
62 
63  case self::CONTEXT_FIELD:
64  $set = $ilDB->query("SELECT field_id id" .
65  " FROM udf_definition");
66  break;
67 
68  default:
69  return [];
70  }
71 
72  $res = [];
73  while ($row = $ilDB->fetchAssoc($set)) {
74  $res[] = $row["id"];
75  }
76  return $res;
77  }
78 
79 
80  // permissions
81 
82  protected function buildPermissionMap(): array // Missing array type.
83  {
84  return [
85  self::CONTEXT_UDF => [
86  "actions" => [
87  self::ACTION_UDF_CREATE_FIELD
88  ]
89  ],
90  self::CONTEXT_FIELD => [
91  "actions" => [
92  self::ACTION_FIELD_EDIT,
93  self::ACTION_FIELD_DELETE
94  ],
95  "subactions" => [
96  self::ACTION_FIELD_EDIT_PROPERTY =>
97  [
98  self::SUBACTION_FIELD_TITLE
99  ,self::SUBACTION_FIELD_PROPERTIES
100  ]
101  ,self::ACTION_FIELD_EDIT_ACCESS =>
102  [
103  self::SUBACTION_FIELD_ACCESS_VISIBLE_PERSONAL
104  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_REGISTRATION
105  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_LOCAL
106  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_COURSES
107  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_GROUPS
108  ,self::SUBACTION_FIELD_ACCESS_CHANGEABLE_PERSONAL
109  ,self::SUBACTION_FIELD_ACCESS_CHANGEABLE_LOCAL
110  ,self::SUBACTION_FIELD_ACCESS_REQUIRED
111  ,self::SUBACTION_FIELD_ACCESS_EXPORT
112  ,self::SUBACTION_FIELD_ACCESS_SEARCHABLE
113  ,self::SUBACTION_FIELD_ACCESS_CERTIFICATE
114  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_PRG
115  ]
116  ]
117  ]
118  ];
119  }
120 
121 
122  // plugins
123 
124  protected function getActivePlugins(): Generator // Missing array type.
125  {
126  global $DIC;
127  $component_factory = $DIC["component.factory"];
128  yield from $component_factory->getActivePluginsInSlot("udfc");
129  }
130 }
$res
Definition: ltiservices.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readContextIds(int $a_context_type)
global $DIC
Definition: shib_login.php:22