ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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 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 108 of file class.ilAdvancedMDPermissionHelper.php.

References array.

109  {
110  return array(
111  self::CONTEXT_MD => array(
112  "actions" => array(
113  self::ACTION_MD_CREATE_RECORD
114  ,self::ACTION_MD_IMPORT_RECORDS
115  )
116  ),
117  self::CONTEXT_RECORD => array(
118  "actions" => array(
119  self::ACTION_RECORD_EDIT
120  ,self::ACTION_RECORD_DELETE
121  ,self::ACTION_RECORD_EXPORT
122  ,self::ACTION_RECORD_TOGGLE_ACTIVATION
123  ,self::ACTION_RECORD_EDIT_FIELDS
124  ,self::ACTION_RECORD_FIELD_POSITIONS
125  ,self::ACTION_RECORD_CREATE_FIELD
126  ),
127  "subactions" => array(
128  self::ACTION_RECORD_EDIT_PROPERTY =>
129  array(
130  self::SUBACTION_RECORD_TITLE
131  ,self::SUBACTION_RECORD_DESCRIPTION
132  ,self::SUBACTION_RECORD_OBJECT_TYPES
133  )
134  )
135  ),
136  self::CONTEXT_FIELD => array(
137  "actions" => array(
138  self::ACTION_FIELD_EDIT,
139  self::ACTION_FIELD_DELETE
140  ),
141  "subactions" => array(
142  self::ACTION_FIELD_EDIT_PROPERTY =>
143  array(
144  self::SUBACTION_FIELD_TITLE
145  ,self::SUBACTION_FIELD_DESCRIPTION
146  ,self::SUBACTION_FIELD_SEARCHABLE
147  ,self::SUBACTION_FIELD_PROPERTIES
148  )
149  )
150  ),
151  self::CONTEXT_SUBSTITUTION => array(
152  "actions" => array(
153  self::ACTION_SUBSTITUTION_SHOW_DESCRIPTION
154  ,self::ACTION_SUBSTITUTION_SHOW_FIELDNAMES
155  ,self::ACTION_SUBSTITUTION_FIELD_POSITIONS
156  )
157  ),
158  self::CONTEXT_SUBSTITUTION_COURSE => array(
159  "actions" => array(
160  self::ACTION_SUBSTITUTION_COURSE_SHOW_FIELD
161  ),
162  "subactions" => array(
163  self::ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY =>
164  array(
165  self::SUBACTION_SUBSTITUTION_BOLD
166  ,self::SUBACTION_SUBSTITUTION_NEWLINE
167  )
168  )
169  ),
170  self::CONTEXT_SUBSTITUTION_CATEGORY => array(
171  "actions" => array(
172  self::ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD
173  ),
174  "subactions" => array(
175  self::ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY =>
176  array(
177  self::SUBACTION_SUBSTITUTION_BOLD
178  ,self::SUBACTION_SUBSTITUTION_NEWLINE
179  )
180  )
181  ),
182  self::CONTEXT_SUBSTITUTION_SESSION => array(
183  "actions" => array(
184  self::ACTION_SUBSTITUTION_SESSION_SHOW_FIELD
185  ),
186  "subactions" => array(
187  self::ACTION_SUBSTITUTION_SESSION_EDIT_FIELD_PROPERTY =>
188  array(
189  self::SUBACTION_SUBSTITUTION_BOLD
190  ,self::SUBACTION_SUBSTITUTION_NEWLINE
191  )
192  )
193  )
194 
195  );
196  }
Create styles array
The data for the language used.

◆ checkPermission()

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

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

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

220  {
221  global $ilAccess;
222 
223  if (!$this->checkPlugins($a_context_type, $a_context_id, $a_action_id, $a_action_sub_id)) {
224  return false;
225  }
226 
227  // export is considered read-action
230  return $ilAccess->checkAccessOfUser($this->getUserId(), "read", "", $this->getRefId());
231  }
232 
233  return $this->checkRBAC();
234  }
$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 201 of file class.ilAdvancedMDPermissionHelper.php.

References $res, array, and IL_COMP_SERVICE.

202  {
203  global $ilPluginAdmin;
204 
205  $res = array();
206 
207  foreach ($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "AdvancedMetaData", "amdc") as $plugin_name) {
208  $res[] = $ilPluginAdmin->getPluginObject(
210  "AdvancedMetaData",
211  "amdc",
212  $plugin_name
213  );
214  }
215 
216  return $res;
217  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
const IL_COMP_SERVICE

◆ readContextIds()

ilAdvancedMDPermissionHelper::readContextIds (   $a_context_type)
protected

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

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

71  {
72  global $ilDB;
73 
74  switch ($a_context_type) {
75  case self::CONTEXT_MD:
76  return array($_REQUEST["ref_id"]);
77 
78  case self::CONTEXT_RECORD:
79  $set = $ilDB->query("SELECT record_id id" .
80  " FROM adv_md_record");
81  break;
82 
83  case self::CONTEXT_FIELD:
84  case self::CONTEXT_SUBSTITUTION_COURSE:
85  case self::CONTEXT_SUBSTITUTION_CATEGORY:
86  case self::CONTEXT_SUBSTITUTION_SESSION:
87  $set = $ilDB->query("SELECT field_id id" .
88  " FROM adv_mdf_definition");
89  break;
90 
91  case self::CONTEXT_SUBSTITUTION:
92  return ['crs','cat','sess'];
93 
94  default:
95  return array();
96  }
97 
98  $res = array();
99  while ($row = $ilDB->fetchAssoc($set)) {
100  $res[] = $row["id"];
101  }
102  return $res;
103  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
$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_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_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: