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

Helper class to create new object types (object_data, RBAC) More...

+ Collaboration diagram for ilDBUpdateNewObjectType:

Static Public Member Functions

static addNewType ($a_type_id, $a_type_title)
 Add new type to object data. More...
 
static addRBACOperations ($a_type_id, array $a_operations)
 Add RBAC operations for type. More...
 
static addRBACOperation ($a_type_id, $a_ops_id)
 Add RBAC operation. More...
 
static isRBACOperation ($a_type_id, $a_ops_id)
 Check if rbac operation exists. More...
 
static deleteRBACOperation ($a_type, $a_ops_id)
 Delete rbac operation. More...
 
static deleteRBACTemplateOperation ($a_type, $a_ops_id)
 Delete operation for type in templates. More...
 
static getCustomRBACOperationId ($a_operation)
 Get id of RBAC operation. More...
 
static addCustomRBACOperation ($a_id, $a_title, $a_class, $a_pos)
 Add custom RBAC operation. More...
 
static getObjectTypeId ($a_type)
 Get id for object data type entry. More...
 
static addRBACCreate ($a_id, $a_title, array $a_parent_types)
 Add create RBAC operations for parent object types. More...
 
static updateOperationOrder ($a_operation, $a_pos)
 Change order of operations. More...
 
static addAdminNode ($a_obj_type, $a_title)
 Create new admin object node. More...
 
static cloneOperation ($a_obj_type, $a_source_op_id, $a_target_op_id)
 Clone RBAC-settings between operations. More...
 
static varchar2text ($a_table_name, $a_column_name)
 Migrate varchar column to text/clob. More...
 
static addRBACTemplate ($a_obj_type, $a_id, $a_description, $a_op_ids)
 Add new RBAC template. More...
 
static setRolePermission (int $a_rol_id, string $a_type, array $a_ops, int $a_ref_id)
 
static applyInitialPermissionGuideline (string $objectType, bool $hasLearningProgress=false, bool $usedForAuthoring=false)
 This method will apply the 'Initial Permissions Guideline' when introducing new object types. More...
 

Data Fields

const RBAC_OP_EDIT_PERMISSIONS = 1
 
const RBAC_OP_VISIBLE = 2
 
const RBAC_OP_READ = 3
 
const RBAC_OP_WRITE = 4
 
const RBAC_OP_DELETE = 6
 
const RBAC_OP_COPY = 99
 

Static Protected Member Functions

static isValidRBACOperation ($a_ops_id)
 Check if given RBAC operation id is valid. More...
 

Static Protected Attributes

static $initialPermissionDefinition
 

Detailed Description

Helper class to create new object types (object_data, RBAC)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Id
class.ilObjFolderGUI.php 25134 2010-08-13 14:22:11Z smeyer

Definition at line 13 of file class.ilDBUpdateNewObjectType.php.

Member Function Documentation

◆ addAdminNode()

static ilDBUpdateNewObjectType::addAdminNode (   $a_obj_type,
  $a_title 
)
static

Create new admin object node.

Parameters
string$a_id
string$a_title

Definition at line 410 of file class.ilDBUpdateNewObjectType.php.

411 {
412 global $ilDB, $tree;
413
414 if (self::getObjectTypeId($a_obj_type)) {
415 return;
416 }
417
418 $obj_type_id = self::addNewType($a_obj_type, $a_title);
419
420 $obj_id = $ilDB->nextId('object_data');
421 $ilDB->manipulate("INSERT INTO object_data " .
422 "(obj_id, type, title, description, owner, create_date, last_update) VALUES (" .
423 $ilDB->quote($obj_id, "integer") . "," .
424 $ilDB->quote($a_obj_type, "text") . "," .
425 $ilDB->quote($a_title, "text") . "," .
426 $ilDB->quote($a_title, "text") . "," .
427 $ilDB->quote(-1, "integer") . "," .
428 $ilDB->now() . "," .
429 $ilDB->now() .
430 ")");
431
432 $ref_id = $ilDB->nextId('object_reference');
433 $ilDB->manipulate("INSERT INTO object_reference " .
434 "(obj_id, ref_id) VALUES (" .
435 $ilDB->quote($obj_id, "integer") . "," .
436 $ilDB->quote($ref_id, "integer") .
437 ")");
438
439 // put in tree
440 require_once("Services/Tree/classes/class.ilTree.php");
441 $tree = new ilTree(ROOT_FOLDER_ID);
442 $tree->insertNode($ref_id, SYSTEM_FOLDER_ID);
443
444 $rbac_ops = array(
445 self::RBAC_OP_EDIT_PERMISSIONS,
446 self::RBAC_OP_VISIBLE,
447 self::RBAC_OP_READ,
448 self::RBAC_OP_WRITE
449 );
450 self::addRBACOperations($obj_type_id, $rbac_ops);
451 }
static addRBACOperations($a_type_id, array $a_operations)
Add RBAC operations for type.
static addNewType($a_type_id, $a_type_title)
Add new type to object data.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilDB

References $ilDB, $tree, addNewType(), and addRBACOperations().

+ Here is the call graph for this function:

◆ addCustomRBACOperation()

static ilDBUpdateNewObjectType::addCustomRBACOperation (   $a_id,
  $a_title,
  $a_class,
  $a_pos 
)
static

Add custom RBAC operation.

Parameters
string$a_id
string$a_title
string$a_class
string$a_pos
Returns
int ops_id

Definition at line 319 of file class.ilDBUpdateNewObjectType.php.

320 {
321 global $ilDB;
322
323 // check if it already exists
324 $ops_id = self::getCustomRBACOperationId($a_id);
325 if ($ops_id) {
326 return $ops_id;
327 }
328
329 if (!in_array($a_class, array('create', 'object', 'general'))) {
330 return;
331 }
332 if ($a_class == 'create') {
333 $a_pos = 9999;
334 }
335
336 $ops_id = $ilDB->nextId('rbac_operations');
337
338 $fields = array(
339 'ops_id' => array('integer', $ops_id),
340 'operation' => array('text', $a_id),
341 'description' => array('text', $a_title),
342 'class' => array('text', $a_class),
343 'op_order' => array('integer', $a_pos),
344 );
345 $ilDB->insert('rbac_operations', $fields);
346
347 return $ops_id;
348 }
static getCustomRBACOperationId($a_operation)
Get id of RBAC operation.

References $ilDB, and getCustomRBACOperationId().

Referenced by addRBACCreate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addNewType()

static ilDBUpdateNewObjectType::addNewType (   $a_type_id,
  $a_type_title 
)
static

Add new type to object data.

Parameters
string$a_type_id
string$a_type_title
Returns
int insert id

Definition at line 128 of file class.ilDBUpdateNewObjectType.php.

129 {
130 global $ilDB;
131
132 // check if it already exists
133 $type_id = self::getObjectTypeId($a_type_id);
134 if ($type_id) {
135 return $type_id;
136 }
137
138 $type_id = $ilDB->nextId('object_data');
139
140 $fields = array(
141 'obj_id' => array('integer', $type_id),
142 'type' => array('text', 'typ'),
143 'title' => array('text', $a_type_id),
144 'description' => array('text', $a_type_title),
145 'owner' => array('integer', -1),
146 'create_date' => array('timestamp', ilUtil::now()),
147 'last_update' => array('timestamp', ilUtil::now())
148 );
149 $ilDB->insert('object_data', $fields);
150
151 return $type_id;
152 }
static getObjectTypeId($a_type)
Get id for object data type entry.
static now()
Return current timestamp in Y-m-d H:i:s format.

References $ilDB, getObjectTypeId(), and ilUtil\now().

Referenced by addAdminNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRBACCreate()

static ilDBUpdateNewObjectType::addRBACCreate (   $a_id,
  $a_title,
array  $a_parent_types 
)
static

Add create RBAC operations for parent object types.

Parameters
string$a_id
string$a_title
array$a_parent_types

Definition at line 375 of file class.ilDBUpdateNewObjectType.php.

376 {
377 $ops_id = self::addCustomRBACOperation($a_id, $a_title, 'create', 9999);
378
379 foreach ($a_parent_types as $type) {
380 $type_id = self::getObjectTypeId($type);
381 if ($type_id) {
382 self::addRBACOperation($type_id, $ops_id);
383 }
384 }
385 }
static addCustomRBACOperation($a_id, $a_title, $a_class, $a_pos)
Add custom RBAC operation.
static addRBACOperation($a_type_id, $a_ops_id)
Add RBAC operation.
$type

References $type, addCustomRBACOperation(), addRBACOperation(), and getObjectTypeId().

+ Here is the call graph for this function:

◆ addRBACOperation()

static ilDBUpdateNewObjectType::addRBACOperation (   $a_type_id,
  $a_ops_id 
)
static

Add RBAC operation.

Parameters
int$a_type_id
int$a_ops_id
Returns
bool

Definition at line 180 of file class.ilDBUpdateNewObjectType.php.

181 {
182 global $ilDB;
183
184 // check if it already exists
185 $set = $ilDB->query('SELECT * FROM rbac_ta' .
186 ' WHERE typ_id = ' . $ilDB->quote($a_type_id, 'integer') .
187 ' AND ops_id = ' . $ilDB->quote($a_ops_id, 'integer'));
188 if ($ilDB->numRows($set)) {
189 return false;
190 }
191
192 $fields = array(
193 'typ_id' => array('integer', $a_type_id),
194 'ops_id' => array('integer', $a_ops_id)
195 );
196 $ilDB->insert('rbac_ta', $fields);
197 return true;
198 }

References $ilDB.

Referenced by addRBACCreate(), and addRBACOperations().

+ Here is the caller graph for this function:

◆ addRBACOperations()

static ilDBUpdateNewObjectType::addRBACOperations (   $a_type_id,
array  $a_operations 
)
static

Add RBAC operations for type.

Parameters
int$a_type_id
array$a_operations

Definition at line 160 of file class.ilDBUpdateNewObjectType.php.

161 {
162 foreach ($a_operations as $ops_id) {
163 if (self::isValidRBACOperation($ops_id)) {
164 if ($ops_id == self::RBAC_OP_COPY) {
165 $ops_id = self::getCustomRBACOperationId('copy');
166 }
167
168 self::addRBACOperation($a_type_id, $ops_id);
169 }
170 }
171 }

References addRBACOperation(), and getCustomRBACOperationId().

Referenced by addAdminNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRBACTemplate()

static ilDBUpdateNewObjectType::addRBACTemplate (   $a_obj_type,
  $a_id,
  $a_description,
  $a_op_ids 
)
static

Add new RBAC template.

Parameters
string$a_obj_type
string$a_id
string$a_description
int | array$a_op_ids

Definition at line 567 of file class.ilDBUpdateNewObjectType.php.

568 {
569 global $ilDB;
570
571 $new_tpl_id = $ilDB->nextId('object_data');
572
573 $ilDB->manipulateF(
574 "INSERT INTO object_data (obj_id, type, title, description," .
575 " owner, create_date, last_update) VALUES (%s, %s, %s, %s, %s, %s, %s)",
576 array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"),
577 array($new_tpl_id, "rolt", $a_id, $a_description, -1, ilUtil::now(), ilUtil::now())
578 );
579
580 $ilDB->manipulateF(
581 "INSERT INTO rbac_fa (rol_id, parent, assign, protected)" .
582 " VALUES (%s, %s, %s, %s)",
583 array("integer", "integer", "text", "text"),
584 array($new_tpl_id, 8, "n", "n")
585 );
586
587 if ($a_op_ids) {
588 if (!is_array($a_op_ids)) {
589 $a_op_ids = array($a_op_ids);
590 }
591 foreach ($a_op_ids as $op_id) {
592 $ilDB->manipulateF(
593 "INSERT INTO rbac_templates (rol_id, type, ops_id, parent)" .
594 " VALUES (%s, %s, %s, %s)",
595 array("integer", "text", "integer", "integer"),
596 array($new_tpl_id, $a_obj_type, $op_id, 8)
597 );
598 }
599 }
600 }

References $ilDB, and ilUtil\now().

+ Here is the call graph for this function:

◆ applyInitialPermissionGuideline()

static ilDBUpdateNewObjectType::applyInitialPermissionGuideline ( string  $objectType,
bool  $hasLearningProgress = false,
bool  $usedForAuthoring = false 
)
static

This method will apply the 'Initial Permissions Guideline' when introducing new object types.

This method does not apply permissions to existing obejcts in the ILIAS repository ('change existing objects').

Parameters
string$objectType
bool$hasLearningProgressA boolean flag whether or not the object type supports learning progress
bool$usedForAuthoringA boolean flag to tell whether or not the object type is mainly used for authoring
See also
https://www.ilias.de/docu/goto_docu_wiki_wpage_2273_1357.html

Definition at line 635 of file class.ilDBUpdateNewObjectType.php.

636 {
637 global $DIC;
638
639 $ilDB = $DIC['ilDB'];
640
641 $objectTypeId = self::getObjectTypeId($objectType);
642 if (!$objectTypeId) {
643 die("Something went wrong, there MUST be valid id for object_type " . $objectType);
644 }
645
646 $objectCreateOperationId = ilDBUpdateNewObjectType::getCustomRBACOperationId('create_' . $objectType);
647 if (!$objectCreateOperationId) {
648 die("Something went wrong, missing CREATE operation id for object type " . $objectType);
649 }
650
651 $globalRoleFolderId = 8; // Maybe there is another way to determine this id
652
653 $learningProgressPermissions = [];
654 if ($hasLearningProgress) {
655 $learningProgressPermissions = array_filter([
656 self::getCustomRBACOperationId('read_learning_progress'),
657 self::getCustomRBACOperationId('edit_learning_progress'),
658 ]);
659 }
660
661 foreach (self::$initialPermissionDefinition as $roleType => $roles) {
662 foreach ($roles as $roleTitle => $definition) {
663 if (
664 true === $usedForAuthoring &&
665 array_key_exists('ignore_for_authoring_objects', $definition) &&
666 true === $definition['ignore_for_authoring_objects']
667 ) {
668 continue;
669 }
670
671 if (array_key_exists('id', $definition) && is_numeric($definition['id'])) {
672 // According to JF (2018-07-02), some roles have to be selected by if, not by title
673 $query = "SELECT obj_id FROM object_data WHERE type = %s AND obj_id = %s";
674 $queryTypes = ['text', 'integer'];
675 $queryValues = [$roleType, $definition['id']];
676 } else {
677 $query = "SELECT obj_id FROM object_data WHERE type = %s AND title = %s";
678 $queryTypes = ['text', 'text'];
679 $queryValues = [$roleType, $roleTitle];
680 }
681
682 $res = $ilDB->queryF($query, $queryTypes, $queryValues);
683 if (1 == $ilDB->numRows($res)) {
684 $row = $ilDB->fetchAssoc($res);
685 $roleId = (int) $row['obj_id'];
686
687 $operationIds = [];
688
689 if (array_key_exists('object', $definition) && is_array($definition['object'])) {
690 $operationIds = array_merge($operationIds, (array) $definition['object']);
691 }
692
693 if (array_key_exists('lp', $definition) && true === $definition['lp']) {
694 $operationIds = array_merge($operationIds, $learningProgressPermissions);
695 }
696
698 $roleId,
699 $objectType,
700 array_filter(array_map('intval', $operationIds)),
701 $globalRoleFolderId
702 );
703
704 if (array_key_exists('create', $definition) && is_array($definition['create'])) {
705 foreach ($definition['create'] as $containerObjectType) {
707 $roleId,
708 $containerObjectType,
709 [
710 $objectCreateOperationId
711 ],
712 $globalRoleFolderId
713 );
714 }
715 }
716 }
717 }
718 }
719 }
static setRolePermission(int $a_rol_id, string $a_type, array $a_ops, int $a_ref_id)
$row
$query
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, $row, getCustomRBACOperationId(), getObjectTypeId(), and setRolePermission().

+ Here is the call graph for this function:

◆ cloneOperation()

static ilDBUpdateNewObjectType::cloneOperation (   $a_obj_type,
  $a_source_op_id,
  $a_target_op_id 
)
static

Clone RBAC-settings between operations.

Parameters
string$a_obj_type
int$a_source_op_id
int$a_target_op_id

Definition at line 460 of file class.ilDBUpdateNewObjectType.php.

461 {
462 global $ilDB;
463
464 // rbac_pa
465 $sql = "SELECT rpa.*" .
466 " FROM rbac_pa rpa" .
467 " JOIN object_reference ref ON (ref.ref_id = rpa.ref_id)" .
468 " JOIN object_data od ON (od.obj_id = ref.obj_id AND od.type = " . $ilDB->quote($a_obj_type) . ")" .
469 // see ilUtil::_getObjectsByOperations()
470 " WHERE (" . $ilDB->like("ops_id", "text", "%i:" . $a_source_op_id . "%") .
471 " OR " . $ilDB->like("ops_id", "text", "%:\"" . $a_source_op_id . "\";%") . ")";
472 $set = $ilDB->query($sql);
473 while ($row = $ilDB->fetchAssoc($set)) {
474 $ops = unserialize($row["ops_id"]);
475 // the query above could match by array KEY, we need extra checks
476 if (in_array($a_source_op_id, $ops) && !in_array($a_target_op_id, $ops)) {
477 $ops[] = $a_target_op_id;
478
479 $ilDB->manipulate("UPDATE rbac_pa" .
480 " SET ops_id = " . $ilDB->quote(serialize($ops), "text") .
481 " WHERE rol_id = " . $ilDB->quote($row["rol_id"], "integer") .
482 " AND ref_id = " . $ilDB->quote($row["ref_id"], "integer"));
483 }
484 }
485
486 // rbac_templates
487 $tmp = array();
488 $sql = "SELECT rol_id, parent, ops_id" .
489 " FROM rbac_templates" .
490 " WHERE type = " . $ilDB->quote($a_obj_type, "text") .
491 " AND (ops_id = " . $ilDB->quote($a_source_op_id, "integer") .
492 " OR ops_id = " . $ilDB->quote($a_target_op_id) . ")";
493 $set = $ilDB->query($sql);
494 while ($row = $ilDB->fetchAssoc($set)) {
495 $tmp[$row["rol_id"]][$row["parent"]][] = $row["ops_id"];
496 }
497
498 foreach ($tmp as $role_id => $parents) {
499 foreach ($parents as $parent_id => $ops_ids) {
500 // only if the target op is missing
501 if (sizeof($ops_ids) < 2 && in_array($a_source_op_id, $ops_ids)) {
502 $ilDB->manipulate("INSERT INTO rbac_templates" .
503 " (rol_id, type, ops_id, parent)" .
504 " VALUES " .
505 "(" . $ilDB->quote($role_id, "integer") .
506 "," . $ilDB->quote($a_obj_type, "text") .
507 "," . $ilDB->quote($a_target_op_id, "integer") .
508 "," . $ilDB->quote($parent_id, "integer") .
509 ")");
510 }
511 }
512 }
513 }

References $ilDB, and $row.

◆ deleteRBACOperation()

static ilDBUpdateNewObjectType::deleteRBACOperation (   $a_type,
  $a_ops_id 
)
static

Delete rbac operation.

Parameters
int$a_type
int$a_ops_id

Definition at line 227 of file class.ilDBUpdateNewObjectType.php.

228 {
229 global $ilDB;
230
231 if (!$a_type || !$a_ops_id) {
232 return;
233 }
234
235 $type_id = self::getObjectTypeId($a_type);
236 if (!$type_id) {
237 return;
238 }
239
240 $query = 'DELETE FROM rbac_ta WHERE ' .
241 'typ_id = ' . $ilDB->quote($type_id, 'integer') . ' AND ' .
242 'ops_id = ' . $ilDB->quote($a_ops_id, 'integer');
243 $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $query);
244 $ilDB->manipulate($query);
245
247 }
static deleteRBACTemplateOperation($a_type, $a_ops_id)
Delete operation for type in templates.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
$a_type
Definition: workflow.php:92

References $a_type, $GLOBALS, $ilDB, $query, deleteRBACTemplateOperation(), and getObjectTypeId().

+ Here is the call graph for this function:

◆ deleteRBACTemplateOperation()

static ilDBUpdateNewObjectType::deleteRBACTemplateOperation (   $a_type,
  $a_ops_id 
)
static

Delete operation for type in templates.

Parameters
string$a_type
int$a_ops_id

Definition at line 255 of file class.ilDBUpdateNewObjectType.php.

256 {
257 global $ilDB;
258
259 if (!$a_type || !$a_ops_id) {
260 return;
261 }
262
263 $query = 'DELETE FROM rbac_templates WHERE ' .
264 'type = ' . $ilDB->quote($a_type, 'text') . ' AND ' .
265 'ops_id = ' . $ilDB->quote($a_ops_id, 'integer');
266 $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $query);
267 $ilDB->manipulate($query);
268 }

References $a_type, $GLOBALS, $ilDB, and $query.

Referenced by deleteRBACOperation().

+ Here is the caller graph for this function:

◆ getCustomRBACOperationId()

static ilDBUpdateNewObjectType::getCustomRBACOperationId (   $a_operation)
static

Get id of RBAC operation.

Parameters
string$a_operation
Returns
int

Definition at line 298 of file class.ilDBUpdateNewObjectType.php.

299 {
300 global $ilDB;
301
302 $sql = 'SELECT ops_id' .
303 ' FROM rbac_operations' .
304 ' WHERE operation = ' . $ilDB->quote($a_operation, 'text');
305 $res = $ilDB->query($sql);
306 $row = $ilDB->fetchAssoc($res);
307 return $row['ops_id'];
308 }

References $ilDB, $res, and $row.

Referenced by addCustomRBACOperation(), addRBACOperations(), applyInitialPermissionGuideline(), and setRolePermission().

+ Here is the caller graph for this function:

◆ getObjectTypeId()

static ilDBUpdateNewObjectType::getObjectTypeId (   $a_type)
static

Get id for object data type entry.

Parameters
string$a_type
Returns
int

Definition at line 356 of file class.ilDBUpdateNewObjectType.php.

357 {
358 global $ilDB;
359
360 $sql = 'SELECT obj_id FROM object_data' .
361 ' WHERE type = ' . $ilDB->quote('typ', 'text') .
362 ' AND title = ' . $ilDB->quote($a_type, 'text');
363 $res = $ilDB->query($sql);
364 $row = $ilDB->fetchAssoc($res);
365 return $row['obj_id'];
366 }

References $a_type, $ilDB, $res, and $row.

Referenced by addNewType(), addRBACCreate(), applyInitialPermissionGuideline(), and deleteRBACOperation().

+ Here is the caller graph for this function:

◆ isRBACOperation()

static ilDBUpdateNewObjectType::isRBACOperation (   $a_type_id,
  $a_ops_id 
)
static

Check if rbac operation exists.

Parameters
int$a_type_idtype id
int$a_ops_idoperation id
Returns
bool

Definition at line 207 of file class.ilDBUpdateNewObjectType.php.

208 {
209 global $ilDB;
210
211 // check if it already exists
212 $set = $ilDB->query('SELECT * FROM rbac_ta' .
213 ' WHERE typ_id = ' . $ilDB->quote($a_type_id, 'integer') .
214 ' AND ops_id = ' . $ilDB->quote($a_ops_id, 'integer'));
215 if ($ilDB->numRows($set)) {
216 return true;
217 }
218 return false;
219 }

References $ilDB.

◆ isValidRBACOperation()

static ilDBUpdateNewObjectType::isValidRBACOperation (   $a_ops_id)
staticprotected

Check if given RBAC operation id is valid.

Parameters
int$a_ops_id
Returns
bool

Definition at line 276 of file class.ilDBUpdateNewObjectType.php.

277 {
278 $valid = array(
279 self::RBAC_OP_EDIT_PERMISSIONS,
280 self::RBAC_OP_VISIBLE,
281 self::RBAC_OP_READ,
282 self::RBAC_OP_WRITE,
283 self::RBAC_OP_DELETE,
284 self::RBAC_OP_COPY
285 );
286 if (in_array($a_ops_id, $valid)) {
287 return true;
288 }
289 return false;
290 }
$valid

References $valid.

◆ setRolePermission()

static ilDBUpdateNewObjectType::setRolePermission ( int  $a_rol_id,
string  $a_type,
array  $a_ops,
int  $a_ref_id 
)
static

Definition at line 602 of file class.ilDBUpdateNewObjectType.php.

603 {
604 global $DIC;
605
606 $ilDB = $DIC['ilDB'];
607
608 foreach ($a_ops as $ops_id) {
609 if ($ops_id == self::RBAC_OP_COPY) {
610 $ops_id = self::getCustomRBACOperationId('copy');
611 }
612
613 $ilDB->replace(
614 'rbac_templates',
615 [
616 'rol_id' => ['integer', $a_rol_id],
617 'type' => ['text', $a_type],
618 'ops_id' => ['integer', $ops_id],
619 'parent' => ['integer', $a_ref_id]
620 ],
621 []
622 );
623 }
624 }

References $a_type, $DIC, $ilDB, and getCustomRBACOperationId().

Referenced by applyInitialPermissionGuideline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateOperationOrder()

static ilDBUpdateNewObjectType::updateOperationOrder (   $a_operation,
  $a_pos 
)
static

Change order of operations.

Parameters
string$a_operation
int$a_pos

Definition at line 393 of file class.ilDBUpdateNewObjectType.php.

394 {
395 global $ilDB;
396
397 $ilDB->update(
398 'rbac_operations',
399 array('op_order' => array('integer', $a_pos)),
400 array('operation' => array('text', $a_operation))
401 );
402 }

References $ilDB.

◆ varchar2text()

static ilDBUpdateNewObjectType::varchar2text (   $a_table_name,
  $a_column_name 
)
static

Migrate varchar column to text/clob.

Parameters
string$a_table_name
string$a_column_name
Returns
bool

Definition at line 522 of file class.ilDBUpdateNewObjectType.php.

523 {
524 global $ilDB;
525
526 $tmp_column_name = $a_column_name . "_tmp_clob";
527
528 if (!$ilDB->tableColumnExists($a_table_name, $a_column_name) ||
529 $ilDB->tableColumnExists($a_table_name, $tmp_column_name)) {
530 return false;
531 }
532
533 // oracle does not support ALTER TABLE varchar2 to CLOB
534
535 $ilAtomQuery = $ilDB->buildAtomQuery();
536 $ilAtomQuery->addTableLock($a_table_name);
537
538 $ilAtomQuery->addQueryCallable(
539 function (ilDBInterface $ilDB) use ($a_table_name, $a_column_name, $tmp_column_name) {
540 $def = array(
541 'type' => 'clob',
542 'notnull' => false
543 );
544 $ilDB->addTableColumn($a_table_name, $tmp_column_name, $def);
545
546 $ilDB->manipulate('UPDATE ' . $a_table_name . ' SET ' . $tmp_column_name . ' = ' . $a_column_name);
547
548 $ilDB->dropTableColumn($a_table_name, $a_column_name);
549
550 $ilDB->renameTableColumn($a_table_name, $tmp_column_name, $a_column_name);
551 }
552 );
553
554 $ilAtomQuery->run();
555
556 return true;
557 }
$def
Definition: croninfo.php:21
Interface ilDBInterface.

References $def, and $ilDB.

Field Documentation

◆ $initialPermissionDefinition

ilDBUpdateNewObjectType::$initialPermissionDefinition
staticprotected

Definition at line 22 of file class.ilDBUpdateNewObjectType.php.

◆ RBAC_OP_COPY

const ilDBUpdateNewObjectType::RBAC_OP_COPY = 99

Definition at line 20 of file class.ilDBUpdateNewObjectType.php.

◆ RBAC_OP_DELETE

const ilDBUpdateNewObjectType::RBAC_OP_DELETE = 6

Definition at line 19 of file class.ilDBUpdateNewObjectType.php.

◆ RBAC_OP_EDIT_PERMISSIONS

const ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS = 1

Definition at line 15 of file class.ilDBUpdateNewObjectType.php.

◆ RBAC_OP_READ

const ilDBUpdateNewObjectType::RBAC_OP_READ = 3

Definition at line 17 of file class.ilDBUpdateNewObjectType.php.

◆ RBAC_OP_VISIBLE

const ilDBUpdateNewObjectType::RBAC_OP_VISIBLE = 2

Definition at line 16 of file class.ilDBUpdateNewObjectType.php.

◆ RBAC_OP_WRITE

const ilDBUpdateNewObjectType::RBAC_OP_WRITE = 4

Definition at line 18 of file class.ilDBUpdateNewObjectType.php.


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