ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUDFPermissionHelper.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "Services/Component/classes/class.ilClaimingPermissionHelper.php";
5 
15 {
16  const CONTEXT_UDF = 1;
17  const CONTEXT_FIELD = 2;
18 
19 
21 
22  const ACTION_FIELD_EDIT = 1;
26 
27 
30 
42 
43 
44  // caching
45 
46  protected function readContextIds($a_context_type)
47  {
48  global $ilDB;
49 
50  switch($a_context_type)
51  {
52  case self::CONTEXT_UDF:
53  return array($_REQUEST["ref_id"]);
54 
55  case self::CONTEXT_FIELD:
56  $set = $ilDB->query("SELECT field_id id".
57  " FROM udf_definition");
58  break;
59 
60  default:
61  return array();
62  }
63 
64  $res = array();
65  while($row = $ilDB->fetchAssoc($set))
66  {
67  $res[] = $row["id"];
68  }
69  return $res;
70  }
71 
72 
73  // permissions
74 
75  protected function buildPermissionMap()
76  {
77  return array(
78  self::CONTEXT_UDF => array(
79  "actions" => array(
80  self::ACTION_UDF_CREATE_FIELD
81  )
82  ),
83  self::CONTEXT_FIELD => array(
84  "actions" => array(
85  self::ACTION_FIELD_EDIT,
86  self::ACTION_FIELD_DELETE
87  ),
88  "subactions" => array(
89  self::ACTION_FIELD_EDIT_PROPERTY =>
90  array(
91  self::SUBACTION_FIELD_TITLE
92  ,self::SUBACTION_FIELD_PROPERTIES
93  )
94  ,self::ACTION_FIELD_EDIT_ACCESS =>
95  array(
96  self::SUBACTION_FIELD_ACCESS_VISIBLE_PERSONAL
97  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_REGISTRATION
98  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_LOCAL
99  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_COURSES
100  ,self::SUBACTION_FIELD_ACCESS_VISIBLE_GROUPS
101  ,self::SUBACTION_FIELD_ACCESS_CHANGEABLE_PERSONAL
102  ,self::SUBACTION_FIELD_ACCESS_CHANGEABLE_LOCAL
103  ,self::SUBACTION_FIELD_ACCESS_REQUIRED
104  ,self::SUBACTION_FIELD_ACCESS_EXPORT
105  ,self::SUBACTION_FIELD_ACCESS_SEARCHABLE
106  ,self::SUBACTION_FIELD_ACCESS_CERTIFICATE
107  )
108  )
109  )
110  );
111  }
112 
113 
114  // plugins
115 
116  protected function getActivePlugins()
117  {
118  global $ilPluginAdmin;
119 
120  $res = array();
121 
122  foreach($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "User", "udfc") as $plugin_name)
123  {
124  $res[] = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
125  "User", "udfc", $plugin_name);
126  }
127 
128  return $res;
129  }
130 }
131 
132 ?>