ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 
49 
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 array($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 array();
70  }
71 
72  $res = array();
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 array(
85  self::CONTEXT_UDF => array(
86  "actions" => array(
87  self::ACTION_UDF_CREATE_FIELD
88  )
89  ),
90  self::CONTEXT_FIELD => array(
91  "actions" => array(
92  self::ACTION_FIELD_EDIT,
93  self::ACTION_FIELD_DELETE
94  ),
95  "subactions" => array(
96  self::ACTION_FIELD_EDIT_PROPERTY =>
97  array(
98  self::SUBACTION_FIELD_TITLE
99  ,self::SUBACTION_FIELD_PROPERTIES
100  )
101  ,self::ACTION_FIELD_EDIT_ACCESS =>
102  array(
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  )
115  )
116  )
117  );
118  }
119 
120 
121  // plugins
122 
123  protected function getActivePlugins(): Generator // Missing array type.
124  {
125  global $DIC;
126  $component_factory = $DIC["component.factory"];
127  yield from $component_factory->getActivePluginsInSlot("udfc");
128  }
129 }
$res
Definition: ltiservices.php:69
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: feed.php:28