ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAdvancedMDPermissionHelper Class Reference

Advanced metadata permission helper. More...

+ Inheritance diagram for ilAdvancedMDPermissionHelper:
+ Collaboration diagram for ilAdvancedMDPermissionHelper:

Data Fields

const CONTEXT_MD = 1
 
const CONTEXT_RECORD = 2
 
const CONTEXT_FIELD = 3
 
const CONTEXT_SUBSTITUTION = 4
 
const CONTEXT_SUBSTITUTION_COURSE = 5
 
const CONTEXT_SUBSTITUTION_CATEGORY = 6
 
const CONTEXT_SUBSTITUTION_SESSION = 7
 
const CONTEXT_SUBSTITUTION_IASS = 8
 
const CONTEXT_SUBSTITUTION_GROUP = 9
 
const ACTION_MD_CREATE_RECORD = 1
 
const ACTION_MD_IMPORT_RECORDS = 2
 
const ACTION_RECORD_EDIT = 5
 
const ACTION_RECORD_DELETE = 6
 
const ACTION_RECORD_EXPORT = 7
 
const ACTION_RECORD_TOGGLE_ACTIVATION = 8
 
const ACTION_RECORD_EDIT_PROPERTY = 9
 
const ACTION_RECORD_EDIT_FIELDS = 10
 
const ACTION_RECORD_CREATE_FIELD = 11
 
const ACTION_RECORD_FIELD_POSITIONS = 12
 
const ACTION_FIELD_EDIT = 13
 
const ACTION_FIELD_DELETE = 14
 
const ACTION_FIELD_EDIT_PROPERTY = 15
 
const ACTION_SUBSTITUTION_SHOW_DESCRIPTION = 16
 
const ACTION_SUBSTITUTION_SHOW_FIELDNAMES = 17
 
const ACTION_SUBSTITUTION_FIELD_POSITIONS = 18
 
const ACTION_SUBSTITUTION_COURSE_SHOW_FIELD = 19
 
const ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY = 20
 
const ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD = 21
 
const ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY = 22
 
const ACTION_SUBSTITUTION_SESSION_SHOW_FIELD = 23
 
const ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY = 24
 
const ACTION_SUBSTITUTION_GROUP_SHOW_FIELD = 25
 
const ACTION_SUBSTITUTION_GROUP_EDIT_FIELD_PROPERTY = 26
 
const ACTION_SUBSTITUTION_IASS_SHOW_FIELD = 27
 
const ACTION_SUBSTITUTION_IASS_EDIT_FIELD_PROPERTY = 28
 
const SUBACTION_RECORD_TITLE = 1
 
const SUBACTION_RECORD_DESCRIPTION = 2
 
const SUBACTION_RECORD_OBJECT_TYPES = 3
 
const SUBACTION_FIELD_TITLE = 4
 
const SUBACTION_FIELD_DESCRIPTION = 5
 
const SUBACTION_FIELD_SEARCHABLE = 6
 
const SUBACTION_FIELD_PROPERTIES = 7
 
const SUBACTION_SUBSTITUTION_BOLD = 8
 
const SUBACTION_SUBSTITUTION_NEWLINE = 9
 

Protected Member Functions

 readContextIds ($a_context_type)
 
 buildPermissionMap ()
 
 getActivePlugins ()
 
 checkPermission ($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
 
- Protected Member Functions inherited from ilClaimingPermissionHelper
 __construct ($a_user_id, $a_ref_id)
 Constructor. More...
 
 setUserId ($a_value)
 Set user id. More...
 
 getUserId ()
 Get user id. More...
 
 setRefId ($a_value)
 Set ref id. More...
 
 getRefId ()
 Get ref id. More...
 
 readContextIds ($a_context_type)
 Get all context ids for context type (from DB, is cached) More...
 
 buildPermissionMap ()
 Build map of context and actions. More...
 
 isValidContextAndAction ($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
 Check if given combination of context and action is valid. More...
 
 getValidContextIds ($a_context_type)
 Get context ids for context type (uses cache) More...
 
 checkPermission ($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
 Check permission (helper: rbac, plugins) More...
 
 checkRBAC ()
 Check permission against RBAC. More...
 
 getActivePlugins ()
 Get active plugins (for current slot) More...
 
 checkPlugins ($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
 Check permission against plugins. More...
 

Additional Inherited Members

- Public Member Functions inherited from ilClaimingPermissionHelper
 reset ()
 Reset (internal caches) More...
 
 hasPermission ($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
 Check permission. More...
 
 hasPermissions ($a_context_type, $a_context_id, array $a_action_ids)
 Check permissions. More...
 
- Static Public Member Functions inherited from ilClaimingPermissionHelper
static getInstance ($a_user_id=null, $a_ref_id=null)
 Factory. More...
 
- Protected Attributes inherited from ilClaimingPermissionHelper
 $user_id
 
 $ref_id
 
 $map
 
 $context_ids
 
 $plugins
 
- Static Protected Attributes inherited from ilClaimingPermissionHelper
static $instances
 

Detailed Description

Advanced metadata permission helper.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 14 of file class.ilAdvancedMDPermissionHelper.php.

Member Function Documentation

◆ buildPermissionMap()

ilAdvancedMDPermissionHelper::buildPermissionMap ( )
protected

Definition at line 120 of file class.ilAdvancedMDPermissionHelper.php.

121  {
122  return array(
123  self::CONTEXT_MD => array(
124  "actions" => array(
125  self::ACTION_MD_CREATE_RECORD
126  ,self::ACTION_MD_IMPORT_RECORDS
127  )
128  ),
129  self::CONTEXT_RECORD => array(
130  "actions" => array(
131  self::ACTION_RECORD_EDIT
132  ,self::ACTION_RECORD_DELETE
133  ,self::ACTION_RECORD_EXPORT
134  ,self::ACTION_RECORD_TOGGLE_ACTIVATION
135  ,self::ACTION_RECORD_EDIT_FIELDS
136  ,self::ACTION_RECORD_FIELD_POSITIONS
137  ,self::ACTION_RECORD_CREATE_FIELD
138  ),
139  "subactions" => array(
140  self::ACTION_RECORD_EDIT_PROPERTY =>
141  array(
142  self::SUBACTION_RECORD_TITLE
143  ,self::SUBACTION_RECORD_DESCRIPTION
144  ,self::SUBACTION_RECORD_OBJECT_TYPES
145  )
146  )
147  ),
148  self::CONTEXT_FIELD => array(
149  "actions" => array(
150  self::ACTION_FIELD_EDIT,
151  self::ACTION_FIELD_DELETE
152  ),
153  "subactions" => array(
154  self::ACTION_FIELD_EDIT_PROPERTY =>
155  array(
156  self::SUBACTION_FIELD_TITLE
157  ,self::SUBACTION_FIELD_DESCRIPTION
158  ,self::SUBACTION_FIELD_SEARCHABLE
159  ,self::SUBACTION_FIELD_PROPERTIES
160  )
161  )
162  ),
163  self::CONTEXT_SUBSTITUTION => array(
164  "actions" => array(
165  self::ACTION_SUBSTITUTION_SHOW_DESCRIPTION
166  ,self::ACTION_SUBSTITUTION_SHOW_FIELDNAMES
167  ,self::ACTION_SUBSTITUTION_FIELD_POSITIONS
168  )
169  ),
170  self::CONTEXT_SUBSTITUTION_COURSE => array(
171  "actions" => array(
172  self::ACTION_SUBSTITUTION_COURSE_SHOW_FIELD
173  ),
174  "subactions" => array(
175  self::ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY =>
176  array(
177  self::SUBACTION_SUBSTITUTION_BOLD
178  ,self::SUBACTION_SUBSTITUTION_NEWLINE
179  )
180  )
181  ),
182  self::CONTEXT_SUBSTITUTION_CATEGORY => array(
183  "actions" => array(
184  self::ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD
185  ),
186  "subactions" => array(
187  self::ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY =>
188  array(
189  self::SUBACTION_SUBSTITUTION_BOLD
190  ,self::SUBACTION_SUBSTITUTION_NEWLINE
191  )
192  )
193  ),
194  self::CONTEXT_SUBSTITUTION_SESSION => array(
195  "actions" => array(
196  self::ACTION_SUBSTITUTION_SESSION_SHOW_FIELD
197  ),
198  "subactions" => array(
199  self::ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY =>
200  array(
201  self::SUBACTION_SUBSTITUTION_BOLD
202  ,self::SUBACTION_SUBSTITUTION_NEWLINE
203  )
204  )
205  ),
206  self::CONTEXT_SUBSTITUTION_GROUP => array(
207  "actions" => array(
208  self::ACTION_SUBSTITUTION_GROUP_SHOW_FIELD
209  ),
210  "subactions" => array(
211  self::ACTION_SUBSTITUTION_GROUP_EDIT_FIELD_PROPERTY =>
212  array(
213  self::SUBACTION_SUBSTITUTION_BOLD
214  ,self::SUBACTION_SUBSTITUTION_NEWLINE
215  )
216  )
217  ),
218  self::CONTEXT_SUBSTITUTION_IASS => array(
219  "actions" => array(
220  self::ACTION_SUBSTITUTION_IASS_SHOW_FIELD
221  ),
222  "subactions" => array(
223  self::ACTION_SUBSTITUTION_IASS_EDIT_FIELD_PROPERTY =>
224  array(
225  self::SUBACTION_SUBSTITUTION_BOLD
226  ,self::SUBACTION_SUBSTITUTION_NEWLINE
227  )
228  )
229  )
230  );
231  }

◆ checkPermission()

ilAdvancedMDPermissionHelper::checkPermission (   $a_context_type,
  $a_context_id,
  $a_action_id,
  $a_action_sub_id = null 
)
protected

Definition at line 256 of file class.ilAdvancedMDPermissionHelper.php.

References $a_context_id, $a_context_type, $DIC, ACTION_RECORD_EXPORT, ilClaimingPermissionHelper\checkPlugins(), ilClaimingPermissionHelper\checkRBAC(), CONTEXT_RECORD, ilClaimingPermissionHelper\getRefId(), and ilClaimingPermissionHelper\getUserId().

257  {
258  global $DIC;
259 
260  $ilAccess = $DIC['ilAccess'];
261 
262  if (!$this->checkPlugins($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id)) {
263  return false;
264  }
265 
266  // export is considered read-action
269  return $ilAccess->checkAccessOfUser($this->getUserId(), "read", "", $this->getRefId());
270  }
271 
272  return $this->checkRBAC();
273  }
global $DIC
Definition: saml.php:7
$a_context_id
Definition: workflow.php:97
checkRBAC()
Check permission against RBAC.
checkPlugins($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id=null)
Check permission against plugins.
$a_context_type
Definition: workflow.php:96
+ Here is the call graph for this function:

◆ getActivePlugins()

ilAdvancedMDPermissionHelper::getActivePlugins ( )
protected

Definition at line 236 of file class.ilAdvancedMDPermissionHelper.php.

References $DIC, $res, and IL_COMP_SERVICE.

237  {
238  global $DIC;
239 
240  $ilPluginAdmin = $DIC['ilPluginAdmin'];
241 
242  $res = array();
243 
244  foreach ($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "AdvancedMetaData", "amdc") as $plugin_name) {
245  $res[] = $ilPluginAdmin->getPluginObject(
247  "AdvancedMetaData",
248  "amdc",
249  $plugin_name
250  );
251  }
252 
253  return $res;
254  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
const IL_COMP_SERVICE

◆ readContextIds()

ilAdvancedMDPermissionHelper::readContextIds (   $a_context_type)
protected

Definition at line 78 of file class.ilAdvancedMDPermissionHelper.php.

References $a_context_type, $DIC, $ilDB, $res, and $row.

79  {
80  global $DIC;
81 
82  $ilDB = $DIC['ilDB'];
83 
84  switch ($a_context_type) {
85  case self::CONTEXT_MD:
86  return array($_REQUEST["ref_id"]);
87 
88  case self::CONTEXT_RECORD:
89  $set = $ilDB->query("SELECT record_id id" .
90  " FROM adv_md_record");
91  break;
92 
93  case self::CONTEXT_FIELD:
94  case self::CONTEXT_SUBSTITUTION_COURSE:
95  case self::CONTEXT_SUBSTITUTION_GROUP:
96  case self::CONTEXT_SUBSTITUTION_SESSION:
97  case self::CONTEXT_SUBSTITUTION_CATEGORY:
98  case self::CONTEXT_SUBSTITUTION_IASS:
99  $set = $ilDB->query("SELECT field_id id" .
100  " FROM adv_mdf_definition");
101  break;
102 
103  case self::CONTEXT_SUBSTITUTION:
104  return ['crs','cat','sess','iass','grp'];
105 
106  default:
107  return array();
108  }
109 
110  $res = array();
111  while ($row = $ilDB->fetchAssoc($set)) {
112  $res[] = $row["id"];
113  }
114  return $res;
115  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$row
$a_context_type
Definition: workflow.php:96
global $ilDB

Field Documentation

◆ ACTION_FIELD_DELETE

const ilAdvancedMDPermissionHelper::ACTION_FIELD_DELETE = 14

◆ ACTION_FIELD_EDIT

const ilAdvancedMDPermissionHelper::ACTION_FIELD_EDIT = 13

◆ ACTION_FIELD_EDIT_PROPERTY

◆ ACTION_MD_CREATE_RECORD

const ilAdvancedMDPermissionHelper::ACTION_MD_CREATE_RECORD = 1

◆ ACTION_MD_IMPORT_RECORDS

const ilAdvancedMDPermissionHelper::ACTION_MD_IMPORT_RECORDS = 2

◆ ACTION_RECORD_CREATE_FIELD

const ilAdvancedMDPermissionHelper::ACTION_RECORD_CREATE_FIELD = 11

◆ ACTION_RECORD_DELETE

const ilAdvancedMDPermissionHelper::ACTION_RECORD_DELETE = 6

◆ ACTION_RECORD_EDIT

const ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT = 5

◆ ACTION_RECORD_EDIT_FIELDS

const ilAdvancedMDPermissionHelper::ACTION_RECORD_EDIT_FIELDS = 10

◆ ACTION_RECORD_EDIT_PROPERTY

◆ ACTION_RECORD_EXPORT

const ilAdvancedMDPermissionHelper::ACTION_RECORD_EXPORT = 7

◆ ACTION_RECORD_FIELD_POSITIONS

const ilAdvancedMDPermissionHelper::ACTION_RECORD_FIELD_POSITIONS = 12

◆ ACTION_RECORD_TOGGLE_ACTIVATION

◆ ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY = 22

◆ ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD = 21

◆ ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY = 20

◆ ACTION_SUBSTITUTION_COURSE_SHOW_FIELD

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_COURSE_SHOW_FIELD = 19

◆ ACTION_SUBSTITUTION_FIELD_POSITIONS

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_FIELD_POSITIONS = 18

◆ ACTION_SUBSTITUTION_GROUP_EDIT_FIELD_PROPERTY

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_GROUP_EDIT_FIELD_PROPERTY = 26

◆ ACTION_SUBSTITUTION_GROUP_SHOW_FIELD

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_GROUP_SHOW_FIELD = 25

◆ ACTION_SUBSTITUTION_IASS_EDIT_FIELD_PROPERTY

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_IASS_EDIT_FIELD_PROPERTY = 28

◆ ACTION_SUBSTITUTION_IASS_SHOW_FIELD

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_IASS_SHOW_FIELD = 27

◆ ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY = 24

◆ ACTION_SUBSTITUTION_SESSION_SHOW_FIELD

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SESSION_SHOW_FIELD = 23

◆ ACTION_SUBSTITUTION_SHOW_DESCRIPTION

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_DESCRIPTION = 16

◆ ACTION_SUBSTITUTION_SHOW_FIELDNAMES

const ilAdvancedMDPermissionHelper::ACTION_SUBSTITUTION_SHOW_FIELDNAMES = 17

◆ CONTEXT_FIELD

◆ CONTEXT_MD

const ilAdvancedMDPermissionHelper::CONTEXT_MD = 1

◆ CONTEXT_RECORD

◆ CONTEXT_SUBSTITUTION

const ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION = 4

◆ CONTEXT_SUBSTITUTION_CATEGORY

const ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION_CATEGORY = 6

◆ CONTEXT_SUBSTITUTION_COURSE

const ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION_COURSE = 5

◆ CONTEXT_SUBSTITUTION_GROUP

const ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION_GROUP = 9

◆ CONTEXT_SUBSTITUTION_IASS

const ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION_IASS = 8

◆ CONTEXT_SUBSTITUTION_SESSION

const ilAdvancedMDPermissionHelper::CONTEXT_SUBSTITUTION_SESSION = 7

◆ SUBACTION_FIELD_DESCRIPTION

const ilAdvancedMDPermissionHelper::SUBACTION_FIELD_DESCRIPTION = 5

◆ SUBACTION_FIELD_PROPERTIES

const ilAdvancedMDPermissionHelper::SUBACTION_FIELD_PROPERTIES = 7

◆ SUBACTION_FIELD_SEARCHABLE

◆ SUBACTION_FIELD_TITLE

const ilAdvancedMDPermissionHelper::SUBACTION_FIELD_TITLE = 4

◆ SUBACTION_RECORD_DESCRIPTION

const ilAdvancedMDPermissionHelper::SUBACTION_RECORD_DESCRIPTION = 2

◆ SUBACTION_RECORD_OBJECT_TYPES

◆ SUBACTION_RECORD_TITLE

const ilAdvancedMDPermissionHelper::SUBACTION_RECORD_TITLE = 1

◆ SUBACTION_SUBSTITUTION_BOLD

const ilAdvancedMDPermissionHelper::SUBACTION_SUBSTITUTION_BOLD = 8

◆ SUBACTION_SUBSTITUTION_NEWLINE

const ilAdvancedMDPermissionHelper::SUBACTION_SUBSTITUTION_NEWLINE = 9

The documentation for this class was generated from the following file: