ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDBUpdateNewObjectType Class Reference

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

+ Collaboration diagram for ilDBUpdateNewObjectType:

Static Public Member Functions

static 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 ($a_rol_id, $a_type, $a_ops, $a_ref_id)
 
static applyInitialPermissionGuideline ($objectType, $hasLearningProgress=false, $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.

References $ilDB, and array.

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  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
global $ilDB

◆ 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.

References $ilDB, and array.

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  }
Create styles array
The data for the language used.
global $ilDB

◆ addNewType()

static 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.

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

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 now()
Return current timestamp in Y-m-d H:i:s format.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call 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.

References $type.

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  }
$type

◆ 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.

References $ilDB, and array.

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  }
Create styles array
The data for the language used.
global $ilDB

◆ 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  }

◆ 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.

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

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  }
static now()
Return current timestamp in Y-m-d H:i:s format.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ applyInitialPermissionGuideline()

static ilDBUpdateNewObjectType::applyInitialPermissionGuideline (   $objectType,
  $hasLearningProgress = false,
  $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 632 of file class.ilDBUpdateNewObjectType.php.

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

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

References $ilDB, $row, and array.

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  }
Create styles array
The data for the language used.
global $ilDB

◆ 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.

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

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 
246  self::deleteRBACTemplateOperation($a_type, $a_ops_id);
247  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$a_type
Definition: workflow.php:92
$query
global $ilDB

◆ 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.

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

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  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$a_type
Definition: workflow.php:92
$query
global $ilDB

◆ 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.

References $ilDB, $res, and $row.

Referenced by applyInitialPermissionGuideline().

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  }
foreach($_POST as $key=> $value) $res
global $ilDB
+ 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.

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

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  }
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
global $ilDB

◆ 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.

References $ilDB.

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  }
global $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.

References $valid, and array.

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
Create styles array
The data for the language used.

◆ setRolePermission()

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

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

References $a_type, $DIC, and $ilDB.

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

◆ 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.

References $ilDB, and array.

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  }
Create styles array
The data for the language used.
global $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.

References $def, $ilDB, ilDBInterface\addTableColumn(), array, ilDBInterface\dropTableColumn(), ilDBInterface\manipulate(), and ilDBInterface\renameTableColumn().

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  }
Interface ilDBInterface.
dropTableColumn($table_name, $column_name)
Create styles array
The data for the language used.
global $ilDB
addTableColumn($table_name, $column_name, $attributes)
$def
Definition: croninfo.php:21
manipulate($query)
Run a (write) Query on the database.
renameTableColumn($table_name, $column_old_name, $column_new_name)
+ Here is the call graph for this function:

Field Documentation

◆ $initialPermissionDefinition

ilDBUpdateNewObjectType::$initialPermissionDefinition
staticprotected
Initial value:
= [
'role' => [
'User' => [
'id' => 4

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: