This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
|
| static array static | addNewType (string $type_id, string $type_title) |
| | Add new type to object data. More...
|
| |
| static | addRBACOperations (int $type_id, array $operations) |
| | Add RBAC operations for type. More...
|
| |
| static | addRBACOperation (int $type_id, int $ops_id) |
| | Add RBAC operation. More...
|
| |
| static | isRBACOperation (int $type_id, int $ops_id) |
| | Check if rbac operation exists. More...
|
| |
| static | deleteRBACOperation (string $type, int $ops_id) |
| | Delete rbac operation. More...
|
| |
| static | deleteRBACTemplateOperation (string $type, int $ops_id) |
| | Delete operation for type in templates. More...
|
| |
| static | getCustomRBACOperationId (string $operation) |
| | Get id of RBAC operation. More...
|
| |
| static | addCustomRBACOperation (string $id, string $title, string $class, int $pos) |
| | Add custom RBAC operation. More...
|
| |
| static | getObjectTypeId (string $type) |
| | Get id for object data type entry. More...
|
| |
| static | addRBACCreate (string $id, string $title, array $parent_types) |
| | Add create RBAC operations for parent object types. More...
|
| |
| static | updateOperationOrder (string $operation, int $pos) |
| | Change order of operations. More...
|
| |
| static | addAdminNode (string $obj_type, string $title) |
| | Create new admin object node. More...
|
| |
| static | cloneOperation (string $obj_type, int $source_op_id, int $target_op_id) |
| | Clone RBAC-settings between operations. 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...
|
| |
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 29 of file class.ilDBUpdateNewObjectType.php.
◆ addAdminNode()
| static ilDBUpdateNewObjectType::addAdminNode |
( |
string |
$obj_type, |
|
|
string |
$title |
|
) |
| |
|
static |
Create new admin object node.
- Deprecated:
- use Services/Tree/classes/Setup/class.ilTreeAdminNodeAddedObjective.php instead
Definition at line 430 of file class.ilDBUpdateNewObjectType.php.
References $ilDB, $ref_id, ilObject\_getObjectTypeIdByTitle(), ROOT_FOLDER_ID, and SYSTEM_FOLDER_ID.
438 $obj_type_id = self::addNewType($obj_type, $title);
439 $obj_id = $ilDB->nextId(
'object_data');
441 'obj_id' => [
'integer', $obj_id],
442 'type' => [
'text', $obj_type],
443 'title' => [
'text', $title],
444 'description' => [
'text', $title],
445 'owner' => [
'integer', -1],
446 'create_date' => [
'timestamp', date(
"Y-m-d H:i:s")],
447 'last_update' => [
'timestamp', date(
"Y-m-d H:i:s")]
449 $ilDB->insert(
"object_data", $values);
452 $ref_id = $ilDB->nextId(
"object_reference");
454 "obj_id" => [
"integer", $obj_id],
455 "ref_id" => [
"integer",
$ref_id]
457 $ilDB->insert(
"object_reference", $values);
460 require_once(
"components/ILIAS/Tree/classes/class.ilTree.php");
465 self::RBAC_OP_EDIT_PERMISSIONS,
466 self::RBAC_OP_VISIBLE,
471 self::addRBACOperations($obj_type_id, $rbac_ops);
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)
◆ addCustomRBACOperation()
| static ilDBUpdateNewObjectType::addCustomRBACOperation |
( |
string |
$id, |
|
|
string |
$title, |
|
|
string |
$class, |
|
|
int |
$pos |
|
) |
| |
|
static |
Add custom RBAC operation.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessCustomRBACOperationAddedObjective.php instead
Definition at line 336 of file class.ilDBUpdateNewObjectType.php.
References $id, $ilDB, and ilRbacReview\_getCustomRBACOperationId().
346 if (!in_array($class, array(
'create',
'object',
'general'))) {
349 if ($class ==
'create') {
353 $ops_id = $ilDB->nextId(
'rbac_operations');
356 'ops_id' => [
'integer', $ops_id],
357 'operation' => [
'text',
$id],
358 'description' => [
'text', $title],
359 'class' => [
'text', $class],
360 'op_order' => [
'integer', $pos]
362 $ilDB->insert(
'rbac_operations', $fields);
static _getCustomRBACOperationId(string $operation, \ilDBInterface $ilDB=null)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ addNewType()
| static array static ilDBUpdateNewObjectType::addNewType |
( |
string |
$type_id, |
|
|
string |
$type_title |
|
) |
| |
|
static |
Add new type to object data.
- Deprecated:
- use Services/Object/classes/Setup/class.ilObjectNewTypeAddedObjective.php instead
Definition at line 142 of file class.ilDBUpdateNewObjectType.php.
References $id, $ilDB, and ilObject\_getObjectTypeIdByTitle().
153 $id = $db->nextId(
"object_data");
156 'obj_id' => [
'integer',
$id],
157 'type' => [
'text',
'typ'],
158 'title' => [
'text', $type_id],
159 'description' => [
'text', $type_title],
160 'owner' => [
'integer', -1],
161 'create_date' => [
'timestamp', date(
"Y-m-d H:i:s")],
162 'last_update' => [
'timestamp', date(
"Y-m-d H:i:s")]
165 $db->insert(
"object_data", $values);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)
◆ addRBACCreate()
| static ilDBUpdateNewObjectType::addRBACCreate |
( |
string |
$id, |
|
|
string |
$title, |
|
|
array |
$parent_types |
|
) |
| |
|
static |
Add create RBAC operations for parent object types.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessCustomRBACOperationAddedObjective.php instead use 'create' for class param
Definition at line 397 of file class.ilDBUpdateNewObjectType.php.
References ilObject\_getObjectTypeIdByTitle().
399 $ops_id = self::addCustomRBACOperation(
$id, $title,
'create', 9999);
401 foreach ($parent_types as $type) {
404 self::addRBACOperation($type_id, $ops_id);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)
◆ addRBACOperation()
| static ilDBUpdateNewObjectType::addRBACOperation |
( |
int |
$type_id, |
|
|
int |
$ops_id |
|
) |
| |
|
static |
Add RBAC operation.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRBACOperationsAddedObjective.php instead
Definition at line 193 of file class.ilDBUpdateNewObjectType.php.
References $ilDB, and $res.
198 "SELECT typ_id" . PHP_EOL
199 .
"FROM rbac_ta" . PHP_EOL
200 .
"WHERE typ_id = " . $ilDB->quote($type_id,
"integer") . PHP_EOL
201 .
"AND ops_id = " . $ilDB->quote($ops_id,
"integer") . PHP_EOL
203 $res = $ilDB->query($sql);
205 if ($ilDB->numRows(
$res)) {
210 'typ_id' => [
'integer', $type_id],
211 'ops_id' => [
'integer', $ops_id]
213 $ilDB->insert(
'rbac_ta', $fields);
◆ addRBACOperations()
| static ilDBUpdateNewObjectType::addRBACOperations |
( |
int |
$type_id, |
|
|
array |
$operations |
|
) |
| |
|
static |
Add RBAC operations for type.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRBACOperationsAddedObjective.php instead
Definition at line 175 of file class.ilDBUpdateNewObjectType.php.
References ilRbacReview\_getCustomRBACOperationId().
177 foreach ($operations as $ops_id) {
178 if (self::isValidRBACOperation($ops_id)) {
179 if ($ops_id == self::RBAC_OP_COPY) {
183 self::addRBACOperation($type_id, $ops_id);
static _getCustomRBACOperationId(string $operation, \ilDBInterface $ilDB=null)
◆ 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
-
| bool | $hasLearningProgress | A boolean flag whether the object type supports learning progress |
| bool | $usedForAuthoring | A boolean flag to tell whether the object type is mainly used for authoring |
- See also
- https://www.ilias.de/docu/goto_docu_wiki_wpage_2273_1357.html
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessInitialPermissionGuidelineAppliedObjective.php instead
Definition at line 579 of file class.ilDBUpdateNewObjectType.php.
References $DIC, $ilDB, $res, ilRbacReview\_getCustomRBACOperationId(), ilObject\_getObjectTypeIdByTitle(), and ILIAS\Repository\int().
586 $ilDB = $DIC[
'ilDB'];
589 if (!$objectTypeId) {
590 die(
"Something went wrong, there MUST be valid id for object_type " . $objectType);
594 if (!$objectCreateOperationId) {
595 die(
"Something went wrong, missing CREATE operation id for object type " . $objectType);
598 $globalRoleFolderId = 8;
600 $learningProgressPermissions = [];
601 if ($hasLearningProgress) {
602 $learningProgressPermissions = array_filter([
608 foreach (self::$initialPermissionDefinition as $roleType => $roles) {
609 foreach ($roles as $roleTitle => $definition) {
612 array_key_exists(
'ignore_for_authoring_objects', $definition) &&
613 true === $definition[
'ignore_for_authoring_objects']
618 if (array_key_exists(
'id', $definition) && is_numeric($definition[
'id'])) {
620 $query =
"SELECT obj_id FROM object_data WHERE type = %s AND obj_id = %s";
621 $queryTypes = [
'text',
'integer'];
622 $queryValues = [$roleType, $definition[
'id']];
624 $query =
"SELECT obj_id FROM object_data WHERE type = %s AND title = %s";
625 $queryTypes = [
'text',
'text'];
626 $queryValues = [$roleType, $roleTitle];
629 $res =
$ilDB->queryF($query, $queryTypes, $queryValues);
632 $roleId = (
int) $row[
'obj_id'];
636 if (array_key_exists(
'object', $definition) && is_array($definition[
'object'])) {
637 $operationIds = array_merge($operationIds, $definition[
'object']);
640 if (array_key_exists(
'lp', $definition) &&
true === $definition[
'lp']) {
641 $operationIds = array_merge($operationIds, $learningProgressPermissions);
644 self::setRolePermission(
647 array_filter(
array_map(
'intval', $operationIds)),
651 if (array_key_exists(
'create', $definition) && is_array($definition[
'create'])) {
652 foreach ($definition[
'create'] as $containerObjectType) {
653 self::setRolePermission(
655 $containerObjectType,
657 $objectCreateOperationId
static _getCustomRBACOperationId(string $operation, \ilDBInterface $ilDB=null)
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)
◆ cloneOperation()
| static ilDBUpdateNewObjectType::cloneOperation |
( |
string |
$obj_type, |
|
|
int |
$source_op_id, |
|
|
int |
$target_op_id |
|
) |
| |
|
static |
Clone RBAC-settings between operations.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRBACOperationClonedObjective.php instead
Definition at line 479 of file class.ilDBUpdateNewObjectType.php.
References $ilDB, and $res.
485 "SELECT rpa.rol_id, rpa.ops_id, rpa.ref_id" . PHP_EOL
486 .
"FROM rbac_pa rpa" . PHP_EOL
487 .
"JOIN object_reference ref ON (ref.ref_id = rpa.ref_id)" . PHP_EOL
488 .
"JOIN object_data od ON (od.obj_id = ref.obj_id AND od.type = " . $db->quote($obj_type,
"text") .
")" . PHP_EOL
489 .
"WHERE (" . $db->like(
"ops_id",
"text",
"%i:" . $source_op_id .
"%") . PHP_EOL
490 .
"OR " . $db->like(
"ops_id",
"text",
"%:\"" . $source_op_id .
"\";%") .
")" . PHP_EOL
493 $res = $db->query($sql);
494 while ($row = $db->fetchAssoc(
$res)) {
495 $ops = unserialize($row[
"ops_id"]);
497 if (in_array($source_op_id, $ops) && !in_array($target_op_id, $ops)) {
498 $ops[] = $target_op_id;
501 "UPDATE rbac_pa" . PHP_EOL
502 .
"SET ops_id = " . $db->quote(serialize($ops),
"text") . PHP_EOL
503 .
"WHERE rol_id = " . $db->quote($row[
"rol_id"],
"integer") . PHP_EOL
504 .
"AND ref_id = " . $db->quote($row[
"ref_id"],
"integer") . PHP_EOL
507 $db->manipulate($sql);
514 "SELECT rol_id, parent, ops_id" . PHP_EOL
515 .
"FROM rbac_templates" . PHP_EOL
516 .
"WHERE type = " . $db->quote($obj_type,
"text") . PHP_EOL
517 .
"AND (ops_id = " . $db->quote($source_op_id,
"integer") . PHP_EOL
518 .
"OR ops_id = " . $db->quote($target_op_id,
"integer") .
")" . PHP_EOL
521 $res = $db->query($sql);
522 while ($row = $db->fetchAssoc(
$res)) {
523 $tmp[$row[
"rol_id"]][$row[
"parent"]][] = $row[
"ops_id"];
526 foreach ($tmp as $role_id => $parents) {
527 foreach ($parents as $parent_id => $ops_ids) {
529 if (count($ops_ids) < 2 && in_array($source_op_id, $ops_ids)) {
531 "rol_id" => [
"integer", $role_id],
532 "type" => [
"text", $obj_type],
533 "ops_id" => [
"integer", $target_op_id],
534 "parent" => [
"integer", $parent_id]
537 $db->insert(
"rbac_templates", $values);
◆ deleteRBACOperation()
| static ilDBUpdateNewObjectType::deleteRBACOperation |
( |
string |
$type, |
|
|
int |
$ops_id |
|
) |
| |
|
static |
Delete rbac operation.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRBACOperationDeletedObjective.php instead
Definition at line 242 of file class.ilDBUpdateNewObjectType.php.
References $GLOBALS, $ilDB, and ilObject\_getObjectTypeIdByTitle().
246 if (!$type || !$ops_id) {
256 "DELETE FROM rbac_ta" . PHP_EOL
257 .
"WHERE typ_id = " . $ilDB->quote($type_id,
"integer") . PHP_EOL
258 .
"AND ops_id = " . $ilDB->quote($ops_id,
"integer") . PHP_EOL
260 $GLOBALS[
'ilLog']->write(__METHOD__ .
': ' . $sql);
261 $ilDB->manipulate($sql);
263 self::deleteRBACTemplateOperation($type, $ops_id);
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)
◆ deleteRBACTemplateOperation()
| static ilDBUpdateNewObjectType::deleteRBACTemplateOperation |
( |
string |
$type, |
|
|
int |
$ops_id |
|
) |
| |
|
static |
Delete operation for type in templates.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRBACOperationDeletedObjective.php instead
Definition at line 271 of file class.ilDBUpdateNewObjectType.php.
References $GLOBALS, and $ilDB.
275 if (!$type || !$ops_id) {
280 "DELETE FROM rbac_templates" . PHP_EOL
281 .
"WHERE type = " . $ilDB->quote($type,
"text") . PHP_EOL
282 .
"ops_id = " . $ilDB->quote($ops_id,
"integer") . PHP_EOL
284 $GLOBALS[
'ilLog']->write(__METHOD__ .
': ' . $sql);
285 $ilDB->manipulate($sql);
◆ getCustomRBACOperationId()
| static ilDBUpdateNewObjectType::getCustomRBACOperationId |
( |
string |
$operation | ) |
|
|
static |
◆ getObjectTypeId()
| static ilDBUpdateNewObjectType::getObjectTypeId |
( |
string |
$type | ) |
|
|
static |
◆ isRBACOperation()
| static ilDBUpdateNewObjectType::isRBACOperation |
( |
int |
$type_id, |
|
|
int |
$ops_id |
|
) |
| |
|
static |
Check if rbac operation exists.
- Deprecated:
- use ilRbacReview::_isRBACOperation instead
Definition at line 223 of file class.ilDBUpdateNewObjectType.php.
References $ilDB.
228 "SELECT typ_id" . PHP_EOL
229 .
"FROM rbac_ta" . PHP_EOL
230 .
"WHERE typ_id = " . $ilDB->quote($type_id,
"integer") . PHP_EOL
231 .
"AND ops_id = " . $ilDB->quote($ops_id,
"integer") . PHP_EOL
234 return (
bool) $ilDB->numRows($ilDB->query($sql));
◆ isValidRBACOperation()
| static ilDBUpdateNewObjectType::isValidRBACOperation |
( |
int |
$ops_id | ) |
|
|
staticprotected |
◆ setRolePermission()
| static ilDBUpdateNewObjectType::setRolePermission |
( |
int |
$a_rol_id, |
|
|
string |
$a_type, |
|
|
array |
$a_ops, |
|
|
int |
$a_ref_id |
|
) |
| |
|
static |
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRolePermissionSetObjective.php instead
Definition at line 546 of file class.ilDBUpdateNewObjectType.php.
References $DIC, $ilDB, and ilRbacReview\_getCustomRBACOperationId().
550 $ilDB = $DIC[
'ilDB'];
552 foreach ($a_ops as $ops_id) {
553 if ($ops_id == self::RBAC_OP_COPY) {
560 'rol_id' => [
'integer', $a_rol_id],
561 'type' => [
'text', $a_type],
562 'ops_id' => [
'integer', $ops_id],
563 'parent' => [
'integer', $a_ref_id]
static _getCustomRBACOperationId(string $operation, \ilDBInterface $ilDB=null)
◆ updateOperationOrder()
| static ilDBUpdateNewObjectType::updateOperationOrder |
( |
string |
$operation, |
|
|
int |
$pos |
|
) |
| |
|
static |
Change order of operations.
- Deprecated:
- use Services/AccessControl/classes/Setup/class.ilAccessRBACOperationOrderUpdatedObjective.php instead
Definition at line 414 of file class.ilDBUpdateNewObjectType.php.
References $ilDB.
420 [
'op_order' => [
'integer', $pos]],
421 [
'operation' => [
'text', $operation]]
◆ $initialPermissionDefinition
| array ilDBUpdateNewObjectType::$initialPermissionDefinition |
|
staticprotected |
◆ RBAC_OP_COPY
| const ilDBUpdateNewObjectType::RBAC_OP_COPY = 99 |
◆ RBAC_OP_DELETE
| const ilDBUpdateNewObjectType::RBAC_OP_DELETE = 6 |
◆ RBAC_OP_EDIT_PERMISSIONS
| const ilDBUpdateNewObjectType::RBAC_OP_EDIT_PERMISSIONS = 1 |
◆ RBAC_OP_READ
| const ilDBUpdateNewObjectType::RBAC_OP_READ = 3 |
◆ RBAC_OP_VISIBLE
| const ilDBUpdateNewObjectType::RBAC_OP_VISIBLE = 2 |
◆ RBAC_OP_WRITE
| const ilDBUpdateNewObjectType::RBAC_OP_WRITE = 4 |
The documentation for this class was generated from the following file: