ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.ilRbacReview.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
36{
37 public const FILTER_ALL = 1;
38 public const FILTER_ALL_GLOBAL = 2;
39 public const FILTER_ALL_LOCAL = 3;
40 public const FILTER_INTERNAL = 4;
41 public const FILTER_NOT_INTERNAL = 5;
42 public const FILTER_TEMPLATES = 6;
43
44 // Cache operation ids
45 private static ?array $_opsCache = null;
46
47 protected static array $assigned_users_cache = [];
48 protected static array $is_assigned_cache = [];
49
54 public function __construct(
55 protected ilDBInterface $db,
56 protected LoggerInterface $log
57 ) {
58 }
59
67 public function roleExists(string $a_title, int $a_id = 0): ?int
68 {
69 $clause = ($a_id) ? " AND obj_id != " . $this->db->quote($a_id, ilDBConstants::T_TEXT) . " " : "";
70
71 $q = "SELECT DISTINCT(obj_id) obj_id FROM object_data " .
72 "WHERE title =" . $this->db->quote($a_title, ilDBConstants::T_TEXT) . " " .
73 "AND type IN('role','rolt')" .
74 $clause . " ";
75 $r = $this->db->query($q);
76 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
77 return (int) $row->obj_id;
78 }
79 return null;
80 }
81
92 protected function __getParentRoles(array $a_path, bool $a_templates): array
93 {
94 $parent_roles = [];
95 $role_hierarchy = [];
96 foreach ($a_path as $ref_id) {
97 $roles = $this->getRoleListByObject($ref_id, $a_templates);
98 foreach ($roles as $role) {
99 $id = (int) $role["obj_id"];
100 $role["parent"] = (int) $ref_id;
101 $parent_roles[$id] = $role;
102
103 if (!array_key_exists($role['obj_id'], $role_hierarchy)) {
104 $role_hierarchy[$id] = $ref_id;
105 }
106 }
107 }
108 return $this->__setProtectedStatus($parent_roles, $role_hierarchy, (int) reset($a_path));
109 }
110
119 public function getParentRoleIds(int $a_endnode_id, bool $a_templates = false): array
120 {
121 global $DIC;
122
123 $tree = $DIC->repositoryTree();
124
125 $pathIds = $tree->getPathId($a_endnode_id);
126
127 // add system folder since it may not in the path
128 //$pathIds[0] = SYSTEM_FOLDER_ID;
129 $pathIds[0] = ROLE_FOLDER_ID;
130 return $this->__getParentRoles($pathIds, $a_templates);
131 }
132
137 public function getRoleListByObject(int $a_ref_id, bool $a_templates = false): array
138 {
139 $role_list = [];
140 $where = $this->__setTemplateFilter($a_templates);
141
142 $query = "SELECT * FROM object_data " .
143 "JOIN rbac_fa ON obj_id = rol_id " .
144 $where .
145 "AND object_data.obj_id = rbac_fa.rol_id " .
146 "AND rbac_fa.parent = " . $this->db->quote($a_ref_id, 'integer') . " ";
147
148 $res = $this->db->query($query);
149 while ($row = $this->db->fetchAssoc($res)) {
150 $row["desc"] = $row["description"];
151 $row["user_id"] = (int) $row["owner"];
152 $row['obj_id'] = (int) $row['obj_id'];
153 $row['rol_id'] = (int) $row['rol_id'];
154 $row['parent'] = (int) $row['parent'];
155 $role_list[] = $row;
156 }
157
158 return $this->__setRoleType($role_list);
159 }
160
165 public function getAssignableRoles(
166 bool $a_templates = false,
167 bool $a_internal_roles = false,
168 string $title_filter = ''
169 ): array {
170 return iterator_to_array(
172 $a_templates,
173 $a_internal_roles,
174 $title_filter
175 )
176 );
177 }
178
183 bool $a_templates = false,
184 bool $a_internal_roles = false,
185 string $title_filter = ''
186 ): Generator {
187 $where = $this->__setTemplateFilter($a_templates);
188 $query = "SELECT * FROM object_data " .
189 "JOIN rbac_fa ON obj_id = rol_id " .
190 $where .
191 "AND rbac_fa.assign = 'y' ";
192
193 if (strlen($title_filter)) {
194 $query .= (' AND ' . $this->db->like(
195 'title',
196 'text',
197 $title_filter . '%'
198 ));
199 }
200 $res = $this->db->query($query);
201
202 while ($row = $this->db->fetchAssoc($res)) {
203 $row["description"] = (string) $row["description"];
204 $row["desc"] = $row["description"];
205 $row["user_id"] = (int) $row["owner"];
206 $row['obj_id'] = (int) $row['obj_id'];
207 $row['parent'] = (int) $row['parent'];
208 yield $this->setRoleTypeAndProtection($row);
209 }
210 }
211
217 public function getAssignableRolesInSubtree(int $ref_id): array
218 {
219 global $DIC;
220
221 $tree = $DIC->repositoryTree();
222 $query = 'SELECT rol_id FROM rbac_fa fa ' .
223 'JOIN tree t1 ON t1.child = fa.parent ' .
224 'JOIN object_data obd ON fa.rol_id = obd.obj_id ' .
225 'WHERE assign = ' . $this->db->quote('y', 'text') . ' ' .
226 'AND obd.type = ' . $this->db->quote('role', 'text') . ' ' .
227 'AND t1.child IN (' .
228 $tree->getSubTreeQuery($ref_id, ['child']) . ' ' .
229 ') ';
230
231 $res = $this->db->query($query);
232
233 $role_list = [];
234 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
235 $role_list[] = (int) $row->rol_id;
236 }
237 return $role_list;
238 }
239
243 public function getAssignableChildRoles(int $a_ref_id): array
244 {
245 $query = "SELECT fa.*, rd.* " .
246 "FROM object_data rd " .
247 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id " .
248 "WHERE fa.assign = 'y' " .
249 "AND fa.parent = " . $this->db->quote($a_ref_id, 'integer') . " ";
250
251 $res = $this->db->query($query);
252 $roles_data = [];
253 while ($row = $this->db->fetchAssoc($res)) {
254 $row['rol_id'] = (int) $row['rol_id'];
255 $row['obj_id'] = (int) $row['obj_id'];
256
257 $roles_data[] = $row;
258 }
259
260 return $roles_data;
261 }
262
266 protected function __setTemplateFilter(bool $a_templates): string
267 {
268 if ($a_templates) {
269 $where = "WHERE " . $this->db->in('object_data.type', ['role', 'rolt'], false, 'text') . " ";
270 } else {
271 $where = "WHERE " . $this->db->in('object_data.type', ['role'], false, 'text') . " ";
272 }
273 return $where;
274 }
275
283 protected function __setRoleType(array $a_role_list): array
284 {
285 foreach ($a_role_list as $key => $val) {
286 $a_role_list[$key] = $this->setRoleTypeAndProtection($val);
287 }
288 return $a_role_list;
289 }
290
291 private function setRoleTypeAndProtection(array $role_list_entry): array
292 {
293 $role_list_entry['role_type'] = $this->buildRoleType($role_list_entry);
294 $role_list_entry['protected'] = $this->buildProtectionByStringValue($role_list_entry['protected']);
295 return $role_list_entry;
296 }
297
298 private function buildRoleType(array $role_list_entry): string
299 {
300 if ($role_list_entry['type'] === 'rolt') {
301 return 'template';
302 }
303
304 if ($role_list_entry['assign'] !== 'y') {
305 return 'linked';
306 }
307
308 if ($role_list_entry['parent'] === ROLE_FOLDER_ID) {
309 return 'global';
310 }
311
312 return 'local';
313 }
314
315 private function buildProtectionByStringValue(string $value): bool
316 {
317 if ($value === 'y') {
318 return true;
319 }
320 return false;
321 }
322
327 public function getNumberOfAssignedUsers(array $a_roles): int
328 {
329 $query = 'select count(distinct(ua.usr_id)) as num from rbac_ua ua ' .
330 'join object_data on ua.usr_id = obj_id ' .
331 'join usr_data ud on ua.usr_id = ud.usr_id ' .
332 'where ' . $this->db->in('rol_id', $a_roles, false, 'integer');
333
334 $res = $this->db->query($query);
335 if ($res->numRows() > 0) {
336 $row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT);
337 return isset($row->num) && is_numeric($row->num) ? (int) $row->num : 0;
338 }
339 return 0;
340 }
341
346 public function assignedUsers(int $a_rol_id): array
347 {
348 if (isset(self::$assigned_users_cache[$a_rol_id])) {
349 return self::$assigned_users_cache[$a_rol_id];
350 }
351
352 $result_arr = [];
353 $query = "SELECT usr_id FROM rbac_ua WHERE rol_id= " . $this->db->quote($a_rol_id, 'integer');
354 $res = $this->db->query($query);
355 while ($row = $this->db->fetchAssoc($res)) {
356 $result_arr[] = (int) $row["usr_id"];
357 }
358 self::$assigned_users_cache[$a_rol_id] = $result_arr;
359 return $result_arr;
360 }
361
365 public function isAssigned(int $a_usr_id, int $a_role_id): bool
366 {
367 if (isset(self::$is_assigned_cache[$a_role_id][$a_usr_id])) {
368 return self::$is_assigned_cache[$a_role_id][$a_usr_id];
369 }
370 // Quickly determine if user is assigned to a role
371 $this->db->setLimit(1, 0);
372 $query = "SELECT usr_id FROM rbac_ua WHERE " .
373 "rol_id= " . $this->db->quote($a_role_id, 'integer') . " " .
374 "AND usr_id= " . $this->db->quote($a_usr_id, ilDBConstants::T_INTEGER);
375 $res = $this->db->query($query);
376 $is_assigned = $res->numRows() == 1;
377 self::$is_assigned_cache[$a_role_id][$a_usr_id] = $is_assigned;
378 return $is_assigned;
379 }
380
389 public function isAssignedToAtLeastOneGivenRole(int $a_usr_id, array $a_role_ids): bool
390 {
391 global $DIC;
392
393 $this->db = $DIC['ilDB'];
394
395 $this->db->setLimit(1, 0);
396 $query = "SELECT usr_id FROM rbac_ua WHERE " .
397 $this->db->in('rol_id', $a_role_ids, false, 'integer') .
398 " AND usr_id= " . $this->db->quote($a_usr_id, ilDBConstants::T_INTEGER);
399 $res = $this->db->query($query);
400
401 return $this->db->numRows($res) == 1;
402 }
403
408 public function assignedRoles(int $a_usr_id): array
409 {
410 $query = "SELECT rol_id FROM rbac_ua WHERE usr_id = " . $this->db->quote($a_usr_id, 'integer');
411
412 $res = $this->db->query($query);
413 $role_arr = [];
414 while ($row = $this->db->fetchObject($res)) {
415 $role_arr[] = (int) $row->rol_id;
416 }
417 return $role_arr;
418 }
419
424 public function assignedGlobalRoles(int $a_usr_id): array
425 {
426 $query = "SELECT ua.rol_id FROM rbac_ua ua " .
427 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
428 "WHERE usr_id = " . $this->db->quote($a_usr_id, 'integer') . ' ' .
429 "AND parent = " . $this->db->quote(ROLE_FOLDER_ID, ilDBConstants::T_INTEGER) . " " .
430 "AND assign = 'y' ";
431
432 $res = $this->db->query($query);
433 $role_arr = [];
434 while ($row = $this->db->fetchObject($res)) {
435 $role_arr[] = (int) $row->rol_id;
436 }
437
438 return $role_arr;
439 }
440
444 public function isAssignable(int $a_rol_id, int $a_ref_id): bool
445 {
446 // exclude system role from rbac
447 if ($a_rol_id == SYSTEM_ROLE_ID) {
448 return true;
449 }
450
451 $query = "SELECT * FROM rbac_fa " .
452 "WHERE rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " .
453 "AND parent = " . $this->db->quote($a_ref_id, 'integer') . " ";
454 $res = $this->db->query($query);
455 while ($row = $this->db->fetchObject($res)) {
456 return $row->assign == 'y';
457 }
458 return false;
459 }
460
461 public function hasMultipleAssignments(int $a_role_id): bool
462 {
463 $query = "SELECT * FROM rbac_fa WHERE rol_id = " . $this->db->quote($a_role_id, 'integer') . ' ' .
464 "AND assign = " . $this->db->quote('y', 'text');
465 $res = $this->db->query($query);
466 return $res->numRows() > 1;
467 }
468
478 public function getFoldersAssignedToRole(int $a_rol_id, bool $a_assignable = false): array
479 {
480 $where = '';
481 if ($a_assignable) {
482 $where = " AND assign ='y'";
483 }
484
485 $query = "SELECT DISTINCT parent FROM rbac_fa " .
486 "WHERE rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " . $where . " ";
487
488 $res = $this->db->query($query);
489 $folders = [];
490 while ($row = $this->db->fetchObject($res)) {
491 $folders[] = (int) $row->parent;
492 }
493 return $folders;
494 }
495
500 public function getRolesOfObject(int $a_ref_id, bool $a_assignable_only = false): array
501 {
502 $and = '';
503 if ($a_assignable_only === true) {
504 $and = 'AND assign = ' . $this->db->quote('y', 'text');
505 }
506 $query = "SELECT rol_id FROM rbac_fa " .
507 "WHERE parent = " . $this->db->quote($a_ref_id, 'integer') . " " .
508 $and;
509
510 $res = $this->db->query($query);
511
512 $role_ids = [];
513 while ($row = $this->db->fetchObject($res)) {
514 $role_ids[] = (int) $row->rol_id;
515 }
516 return $role_ids;
517 }
518
526 public function getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable = true): array
527 {
528 $and = '';
529 if ($a_nonassignable === false) {
530 $and = " AND assign='y'";
531 }
532
533 $query = "SELECT rol_id FROM rbac_fa " .
534 "WHERE parent = " . $this->db->quote($a_ref_id, 'integer') . " " .
535 $and;
536
537 $res = $this->db->query($query);
538 $rol_id = [];
539 while ($row = $this->db->fetchObject($res)) {
540 $rol_id[] = (int) $row->rol_id;
541 }
542
543 return $rol_id;
544 }
545
551 public function getGlobalRoles(): array
552 {
553 return $this->getRolesOfRoleFolder(ROLE_FOLDER_ID, false);
554 }
555
560 public function getLocalRoles(int $a_ref_id): array
561 {
562 $lroles = [];
563 foreach ($this->getRolesOfRoleFolder($a_ref_id) as $role_id) {
564 if ($this->isAssignable($role_id, $a_ref_id)) {
565 $lroles[] = $role_id;
566 }
567 }
568 return $lroles;
569 }
570
575 public function getLocalPolicies(int $a_ref_id): array
576 {
577 $lroles = [];
578 foreach ($this->getRolesOfRoleFolder($a_ref_id) as $role_id) {
579 $lroles[] = $role_id;
580 }
581 return $lroles;
582 }
583
588 public function getGlobalRolesArray(): array
589 {
590 $ga = [];
591 foreach ($this->getRolesOfRoleFolder(ROLE_FOLDER_ID, false) as $role_id) {
592 $ga[] = ['obj_id' => $role_id,
593 'role_type' => 'global'
594 ];
595 }
596 return $ga;
597 }
598
603 public function getGlobalAssignableRoles(): array
604 {
605 $ga = [];
606 foreach ($this->getGlobalRoles() as $role_id) {
607 if (ilObjRole::_getAssignUsersStatus($role_id)) {
608 $ga[] = [
609 'obj_id' => $role_id,
610 'role_type' => 'global'
611 ];
612 }
613 }
614 return $ga;
615 }
616
620 public function isRoleAssignedToObject(int $a_role_id, int $a_parent_id): bool
621 {
622 $query = 'SELECT * FROM rbac_fa ' .
623 'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
624 'AND parent = ' . $this->db->quote($a_parent_id, 'integer');
625 $res = $this->db->query($query);
626 return (bool) $res->numRows();
627 }
628
633 public function getOperations(): array
634 {
635 $query = 'SELECT * FROM rbac_operations ORDER BY ops_id ';
636 $res = $this->db->query($query);
637 $ops = [];
638 while ($row = $this->db->fetchObject($res)) {
639 $ops[] = ['ops_id' => (int) $row->ops_id,
640 'operation' => $row->operation,
641 'description' => $row->description
642 ];
643 }
644 return $ops;
645 }
646
651 public function getOperation(int $ops_id): array
652 {
653 $query = 'SELECT * FROM rbac_operations WHERE ops_id = ' . $this->db->quote($ops_id, 'integer');
654 $res = $this->db->query($query);
655 $ops = [];
656 while ($row = $this->db->fetchObject($res)) {
657 $ops = ['ops_id' => (int) $row->ops_id,
658 'operation' => $row->operation,
659 'description' => $row->description
660 ];
661 }
662 return $ops;
663 }
664
670 public function getAllOperationsOfRole(int $a_rol_id, int $a_parent = 0): array
671 {
672 if (!$a_parent) {
673 $a_parent = ROLE_FOLDER_ID;
674 }
675 $query = "SELECT ops_id,type FROM rbac_templates " .
676 "WHERE rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " .
677 "AND parent = " . $this->db->quote($a_parent, 'integer');
678 $res = $this->db->query($query);
679
680 $ops_arr = [];
681 while ($row = $this->db->fetchObject($res)) {
682 $ops_arr[$row->type][] = (int) $row->ops_id;
683 }
684 return $ops_arr;
685 }
686
690 public function getActiveOperationsOfRole(int $a_ref_id, int $a_role_id): array
691 {
692 $query = 'SELECT * FROM rbac_pa ' .
693 'WHERE ref_id = ' . $this->db->quote($a_ref_id, 'integer') . ' ' .
694 'AND rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ';
695
696 $res = $this->db->query($query);
697 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
698 return array_map(
699 intval(...),
700 $row['ops_id'] === ':' ? [] : unserialize($row['ops_id'], ['allowed_classes' => false])
701 );
702 }
703 return [];
704 }
705
711 public function getOperationsOfRole(int $a_rol_id, string $a_type, int $a_parent = 0): array
712 {
713 $ops_arr = [];
714 // if no rolefolder id is given, assume global role folder as target
715 if ($a_parent == 0) {
716 $a_parent = ROLE_FOLDER_ID;
717 }
718
719 $query = "SELECT ops_id FROM rbac_templates " .
720 "WHERE type =" . $this->db->quote($a_type, 'text') . " " .
721 "AND rol_id = " . $this->db->quote($a_rol_id, 'integer') . " " .
722 "AND parent = " . $this->db->quote($a_parent, 'integer');
723 $res = $this->db->query($query);
724 while ($row = $this->db->fetchObject($res)) {
725 $ops_arr[] = $row->ops_id;
726 }
727 return $ops_arr;
728 }
729
733 public function getRoleOperationsOnObject(int $a_role_id, int $a_ref_id): array
734 {
735 $query = "SELECT ops_id FROM rbac_pa " .
736 "WHERE rol_id = " . $this->db->quote($a_role_id, 'integer') . " " .
737 "AND ref_id = " . $this->db->quote($a_ref_id, 'integer') . " ";
738
739 $res = $this->db->query($query);
740 $ops = [];
741 while ($row = $this->db->fetchObject($res)) {
742 if ($row->ops_id !== ':') {
743 $ops = array_map(
744 intval(...),
745 unserialize($row->ops_id, ['allowed_classes' => false])
746 );
747 }
748 }
749
750 return $ops;
751 }
752
757 public function getOperationsOnType(int $a_typ_id): array
758 {
759 $query = 'SELECT ta.ops_id FROM rbac_ta ta JOIN rbac_operations o ON ta.ops_id = o.ops_id ' .
760 'WHERE typ_id = ' . $this->db->quote($a_typ_id, 'integer') . ' ' .
761 'ORDER BY op_order';
762
763 $res = $this->db->query($query);
764 $ops_id = [];
765 while ($row = $this->db->fetchObject($res)) {
766 $ops_id[] = (int) $row->ops_id;
767 }
768 return $ops_id;
769 }
770
775 public function getOperationsOnTypeString(string $a_type): array
776 {
777 $query = "SELECT * FROM object_data WHERE type = 'typ' AND title = " . $this->db->quote($a_type, 'text') . " ";
778 $res = $this->db->query($query);
779 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
780 return $this->getOperationsOnType((int) $row->obj_id);
781 }
782 return [];
783 }
784
789 public function getOperationsByTypeAndClass(string $a_type, string $a_class): array
790 {
791 if ($a_class != 'create') {
792 $condition = "AND class != " . $this->db->quote('create', 'text');
793 } else {
794 $condition = "AND class = " . $this->db->quote('create', 'text');
795 }
796
797 $query = "SELECT ro.ops_id FROM rbac_operations ro " .
798 "JOIN rbac_ta rt ON ro.ops_id = rt.ops_id " .
799 "JOIN object_data od ON rt.typ_id = od.obj_id " .
800 "WHERE type = " . $this->db->quote('typ', 'text') . " " .
801 "AND title = " . $this->db->quote($a_type, 'text') . " " .
802 $condition . " " .
803 "ORDER BY op_order ";
804
805 $res = $this->db->query($query);
806 $ops = [];
807 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
808 $ops[] = (int) $row->ops_id;
809 }
810 return $ops;
811 }
812
818 public function getObjectsWithStopedInheritance(int $a_rol_id, array $a_filter = []): array
819 {
820 $query = 'SELECT parent p FROM rbac_fa ' .
821 'WHERE assign = ' . $this->db->quote('n', 'text') . ' ' .
822 'AND rol_id = ' . $this->db->quote($a_rol_id, 'integer') . ' ';
823
824 if ($a_filter !== []) {
825 $query .= ('AND ' . $this->db->in('parent', (array) $a_filter, false, 'integer'));
826 }
827
828 $res = $this->db->query($query);
829 $parent = [];
830 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
831 $parent[] = (int) $row->p;
832 }
833 return $parent;
834 }
835
840 public function isDeleted(int $a_node_id): bool
841 {
842 $q = "SELECT tree FROM tree WHERE child =" . $this->db->quote($a_node_id, ilDBConstants::T_INTEGER) . " ";
843 $r = $this->db->query($q);
844 $row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
845
846 if (!$row) {
847 $message = sprintf(
848 '%s::isDeleted(): Role folder with ref_id %s not found!',
849 get_class($this),
850 $a_node_id
851 );
852 $this->log->warning($message);
853 return true;
854 }
855 return $row->tree < 0;
856 }
857
861 public function isGlobalRole(int $a_role_id): bool
862 {
863 return in_array($a_role_id, $this->getGlobalRoles());
864 }
865
869 public function getRolesByFilter(int $a_filter = 0, int $a_user_id = 0, string $title_filter = ''): Generator
870 {
871 $assign = "y";
872 switch ($a_filter) {
873 case self::FILTER_ALL:
874 return yield from $this->getAssignableRolesGenerator(true, true, $title_filter);
875
876 case self::FILTER_ALL_GLOBAL:
877 $where = 'WHERE ' . $this->db->in('rbac_fa.rol_id', $this->getGlobalRoles(), false, 'integer') . ' ';
878 break;
879
880 case self::FILTER_ALL_LOCAL:
881 case self::FILTER_INTERNAL:
882 case self::FILTER_NOT_INTERNAL:
883 $where = 'WHERE ' . $this->db->in('rbac_fa.rol_id', $this->getGlobalRoles(), true, 'integer');
884 break;
885
886 case self::FILTER_TEMPLATES:
887 $where = "WHERE object_data.type = 'rolt'";
888 $assign = "n";
889 break;
890
891 case 0:
892 default:
893 if (!$a_user_id) {
894 return;
895 }
896
897 $where = 'WHERE ' . $this->db->in(
898 'rbac_fa.rol_id',
899 $this->assignedRoles($a_user_id),
900 false,
901 'integer'
902 ) . ' ';
903 break;
904 }
905
906 $query = "SELECT * FROM object_data " .
907 "JOIN rbac_fa ON obj_id = rol_id " .
908 $where .
909 "AND rbac_fa.assign = " . $this->db->quote($assign, 'text') . " ";
910
911 if (strlen($title_filter)) {
912 $query .= (' AND ' . $this->db->like(
913 'title',
914 'text',
915 '%' . $title_filter . '%'
916 ));
917 }
918
919 $res = $this->db->query($query);
920 while ($row = $this->db->fetchAssoc($res)) {
921 $row['title'] = $row['title'] ?? '';
922 $prefix = str_starts_with($row['title'], "il_");
923
924 // all (assignable) internal local roles only
925 if ($a_filter == 4 && !$prefix) {
926 continue;
927 }
928
929 // all (assignable) non internal local roles only
930 if ($a_filter == 5 && $prefix) {
931 continue;
932 }
933
934 $row['description'] = $row['description'] ?? '';
935 $row["desc"] = $row["description"];
936 $row["user_id"] = (int) $row["owner"];
937 $row['obj_id'] = (int) $row['obj_id'];
938 $row['rol_id'] = (int) $row['rol_id'];
939 $row['parent'] = (int) $row['parent'];
940
941 yield $this->setRoleTypeAndProtection($row);
942 }
943 }
944
945 public function getTypeId(string $a_type): int
946 {
947 $q = "SELECT obj_id FROM object_data " .
948 "WHERE title=" . $this->db->quote($a_type, 'text') . " AND type='typ'";
949 $r = $this->db->query($q);
950 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
951 return (int) $row->obj_id;
952 }
953 return 0;
954 }
955
962 public static function _getOperationIdsByName(array $operations): array
963 {
964 global $DIC;
965
966 $ilDB = $DIC->database();
967 if ($operations === []) {
968 return [];
969 }
970
971 $query = 'SELECT ops_id FROM rbac_operations ' .
972 'WHERE ' . $ilDB->in('operation', $operations, false, 'text');
973
974 $res = $ilDB->query($query);
975 $ops_ids = [];
976 while ($row = $ilDB->fetchObject($res)) {
977 $ops_ids[] = (int) $row->ops_id;
978 }
979 return $ops_ids;
980 }
981
985 public static function _getOperationIdByName(string $a_operation): int
986 {
987 global $DIC;
988
989 $ilDB = $DIC->database();
990
991 // Cache operation ids
992 if (!is_array(self::$_opsCache)) {
993 self::$_opsCache = [];
994
995 $q = "SELECT ops_id, operation FROM rbac_operations";
996 $r = $ilDB->query($q);
997 while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
998 self::$_opsCache[$row->operation] = (int) $row->ops_id;
999 }
1000 }
1001
1002 // Get operation ID by name from cache
1003 if (array_key_exists($a_operation, self::$_opsCache)) {
1004 return self::$_opsCache[$a_operation];
1005 }
1006 return 0;
1007 }
1008
1014 public static function lookupCreateOperationIds(array $a_type_arr): array
1015 {
1016 global $DIC;
1017
1018 $ilDB = $DIC->database();
1019
1020 $operations = [];
1021 foreach ($a_type_arr as $type) {
1022 $operations[] = ('create_' . $type);
1023 }
1024
1025 if ($operations === []) {
1026 return [];
1027 }
1028
1029 $query = 'SELECT ops_id, operation FROM rbac_operations ' .
1030 'WHERE ' . $ilDB->in('operation', $operations, false, 'text');
1031
1032 $res = $ilDB->query($query);
1033
1034 $ops_ids = [];
1035 while ($row = $ilDB->fetchObject($res)) {
1036 $type_arr = explode('_', $row->operation);
1037 $type = $type_arr[1];
1038
1039 $ops_ids[$type] = (int) $row->ops_id;
1040 }
1041 return $ops_ids;
1042 }
1043
1047 public function isProtected(int $a_ref_id, int $a_role_id): bool
1048 {
1049 $query = 'SELECT protected FROM rbac_fa ' .
1050 'WHERE rol_id = ' . $this->db->quote($a_role_id, ilDBConstants::T_INTEGER);
1051 $res = $this->db->query($query);
1052 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1053 if ($row->protected === 'y') {
1054 return true;
1055 }
1056 }
1057 return false;
1058 }
1059
1060 public function isBlockedAtPosition(int $a_role_id, int $a_ref_id): bool
1061 {
1062 $query = 'SELECT blocked from rbac_fa ' .
1063 'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1064 'AND parent = ' . $this->db->quote($a_ref_id, 'integer');
1065 $res = $this->db->query($query);
1066 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1067 return (bool) $row->blocked;
1068 }
1069 return false;
1070 }
1071
1076 public function isBlockedInUpperContext(int $a_role_id, int $a_ref_id): bool
1077 {
1078 global $DIC;
1079
1080 $tree = $DIC['tree'];
1081
1082 if ($this->isBlockedAtPosition($a_role_id, $a_ref_id)) {
1083 return false;
1084 }
1085 $query = 'SELECT parent from rbac_fa ' .
1086 'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1087 'AND blocked = ' . $this->db->quote(1, 'integer');
1088 $res = $this->db->query($query);
1089
1090 $parent_ids = [];
1091 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1092 $parent_ids[] = (int) $row->parent;
1093 }
1094
1095 foreach ($parent_ids as $parent_id) {
1096 if ($tree->isGrandChild($parent_id, $a_ref_id)) {
1097 return true;
1098 }
1099 }
1100 return false;
1101 }
1102
1103 // this method alters the protected status of role regarding the current user's role assignment
1104 // and current postion in the hierarchy.
1105 protected function __setProtectedStatus(array $a_parent_roles, array $a_role_hierarchy, int $a_ref_id): array
1106 {
1107 global $DIC;
1108
1109 $rbacsystem = $DIC->rbac()->system();
1110 $ilUser = $DIC->user();
1111 if (in_array(SYSTEM_ROLE_ID, $this->assignedRoles($ilUser->getId()))) {
1112 $leveladmin = true;
1113 } else {
1114 $leveladmin = false;
1115 }
1116 foreach ($a_role_hierarchy as $role_id => $rolf_id) {
1117 if ($leveladmin == true) {
1118 $a_parent_roles[$role_id]['protected'] = false;
1119 continue;
1120 }
1121
1122 if ($a_parent_roles[$role_id]['protected'] == true) {
1123 $arr_lvl_roles_user = array_intersect(
1124 $this->assignedRoles($ilUser->getId()),
1125 array_keys($a_role_hierarchy, $rolf_id)
1126 );
1127
1128 foreach ($arr_lvl_roles_user as $lvl_role_id) {
1129 // check if role grants 'edit_permission' to parent
1130 $rolf = $a_parent_roles[$role_id]['parent'];
1131 if ($rbacsystem->checkPermission($rolf, $lvl_role_id, 'edit_permission')) {
1132 $a_parent_roles[$role_id]['protected'] = false;
1133 }
1134 }
1135 }
1136 }
1137 return $a_parent_roles;
1138 }
1139
1144 public static function _getOperationList(string $a_type = ''): array
1145 {
1146 global $DIC;
1147
1148 $ilDB = $DIC->database();
1149 $arr = [];
1150 if ($a_type) {
1151 $query = sprintf(
1152 'SELECT * FROM rbac_operations ' .
1153 'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id ' .
1154 'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id ' .
1155 'WHERE object_data.title = %s ' .
1156 'AND object_data.type = %s ' .
1157 'ORDER BY op_order ASC',
1158 $ilDB->quote($a_type, 'text'),
1159 $ilDB->quote('typ', 'text')
1160 );
1161 } else {
1162 $query = 'SELECT * FROM rbac_operations ORDER BY op_order ASC';
1163 }
1164 $res = $ilDB->query($query);
1165 while ($row = $ilDB->fetchAssoc($res)) {
1166 $arr[] = [
1167 "ops_id" => (int) $row['ops_id'],
1168 "operation" => $row['operation'],
1169 "desc" => $row['description'],
1170 "class" => $row['class'],
1171 "order" => (int) $row['op_order']
1172 ];
1173 }
1174 return $arr;
1175 }
1176
1180 public static function _groupOperationsByClass(array $a_ops_arr): array
1181 {
1182 $arr = [];
1183 foreach ($a_ops_arr as $ops) {
1184 $arr[$ops['class']][] = ['ops_id' => (int) $ops['ops_id'],
1185 'name' => $ops['operation']
1186 ];
1187 }
1188 return $arr;
1189 }
1190
1195 public function getObjectOfRole(int $a_role_id): int
1196 {
1197 // internal cache
1198 static $obj_cache = [];
1199
1200 if (isset($obj_cache[$a_role_id]) && $obj_cache[$a_role_id]) {
1201 return $obj_cache[$a_role_id];
1202 }
1203
1204 $query = 'SELECT obr.obj_id FROM rbac_fa rfa ' .
1205 'JOIN object_reference obr ON rfa.parent = obr.ref_id ' .
1206 'WHERE assign = ' . $this->db->quote('y', 'text') . ' ' .
1207 'AND rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1208 'AND deleted IS NULL';
1209
1210 $res = $this->db->query($query);
1211 $obj_cache[$a_role_id] = 0;
1212 while ($row = $this->db->fetchObject($res)) {
1213 $obj_cache[$a_role_id] = (int) $row->obj_id;
1214 }
1215 return $obj_cache[$a_role_id];
1216 }
1217
1218 public function getObjectReferenceOfRole(int $a_role_id): int
1219 {
1220 $query = 'SELECT parent p_ref FROM rbac_fa ' .
1221 'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1222 'AND assign = ' . $this->db->quote('y', 'text');
1223
1224 $res = $this->db->query($query);
1225 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1226 return (int) $row->p_ref;
1227 }
1228 return 0;
1229 }
1230
1234 public function isRoleDeleted(int $a_role_id): bool
1235 {
1236 $rolf_list = $this->getFoldersAssignedToRole($a_role_id, false);
1237 $deleted = true;
1238 if ($rolf_list !== []) {
1239 foreach ($rolf_list as $rolf) {
1240 // only list roles that are not set to status "deleted"
1241 if (!$this->isDeleted($rolf)) {
1242 $deleted = false;
1243 break;
1244 }
1245 }
1246 }
1247 return $deleted;
1248 }
1249
1250 public function getRolesForIDs(array $role_ids, bool $use_templates): array
1251 {
1252 $where = $this->__setTemplateFilter($use_templates);
1253 $query = "SELECT * FROM object_data " .
1254 "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id " .
1255 $where .
1256 "AND rbac_fa.assign = 'y' " .
1257 'AND ' . $this->db->in('object_data.obj_id', $role_ids, false, 'integer');
1258
1259 $res = $this->db->query($query);
1260 $role_list = [];
1261 while ($row = $this->db->fetchAssoc($res)) {
1262 $row["desc"] = $row["description"];
1263 $row["user_id"] = (int) $row["owner"];
1264 $role_list[] = $row;
1265 }
1266 return $this->__setRoleType($role_list);
1267 }
1268
1273 public function getOperationAssignment(): array
1274 {
1275 global $DIC;
1276
1277 $this->db = $DIC['ilDB'];
1278
1279 $query = 'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta ' .
1280 'JOIN object_data obj ON obj.obj_id = ta.typ_id ' .
1281 'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1282 $res = $this->db->query($query);
1283
1284 $counter = 0;
1285 $info = [];
1286 while ($row = $this->db->fetchObject($res)) {
1287 $info[$counter]['typ_id'] = (int) $row->typ_id;
1288 $info[$counter]['type'] = $row->title;
1289 $info[$counter]['ops_id'] = (int) $row->ops_id;
1290 $info[$counter]['operation'] = $row->operation;
1291 $counter++;
1292 }
1293
1294 return array_values($info);
1295 }
1296
1300 public function isDeleteable(int $a_role_id, int $a_rolf_id): bool
1301 {
1302 if (!$this->isAssignable($a_role_id, $a_rolf_id)) {
1303 return false;
1304 }
1305 if ($a_role_id == SYSTEM_ROLE_ID or $a_role_id == ANONYMOUS_ROLE_ID) {
1306 return false;
1307 }
1308 if (str_starts_with(ilObject::_lookupTitle($a_role_id), 'il_')) {
1309 return false;
1310 }
1311 return true;
1312 }
1313
1317 public function isSystemGeneratedRole(int $a_role_id): bool
1318 {
1319 $title = ilObject::_lookupTitle($a_role_id);
1320 return substr($title, 0, 3) == 'il_';
1321 }
1322
1323 public function getParentOfRole(int $role_id, ?int $object_ref = null): ?int
1324 {
1325 global $DIC;
1327 $tree = $DIC['tree'];
1328
1329 if ($object_ref === null || $object_ref === ROLE_FOLDER_ID) {
1330 return $this->getRoleFolderOfRole($role_id);
1331 }
1332
1333
1334 $path_ids = $tree->getPathId($object_ref);
1335 array_unshift($path_ids, ROLE_FOLDER_ID);
1336
1337 while ($ref_id = array_pop($path_ids)) {
1338 $roles = $this->getRoleListByObject($ref_id, false);
1339 foreach ($roles as $role) {
1340 if ((int) $role['obj_id'] === $role_id) {
1341 return $ref_id;
1342 }
1343 }
1344 }
1345
1346 return null;
1347 }
1348
1349
1350 public function getRoleFolderOfRole(int $a_role_id): int
1351 {
1352 if (ilObject::_lookupType($a_role_id) == 'role') {
1353 $and = ('AND assign = ' . $this->db->quote('y', 'text'));
1354 } else {
1355 $and = '';
1356 }
1357
1358 $query = 'SELECT * FROM rbac_fa ' .
1359 'WHERE rol_id = ' . $this->db->quote($a_role_id, 'integer') . ' ' .
1360 $and;
1361 $res = $this->db->query($query);
1362 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1363 return (int) $row->parent;
1364 }
1365 return 0;
1366 }
1367
1372 public function getUserPermissionsOnObject(int $a_user_id, int $a_ref_id): array
1373 {
1374 $query = "SELECT ops_id FROM rbac_pa JOIN rbac_ua " .
1375 "ON (rbac_pa.rol_id = rbac_ua.rol_id) " .
1376 "WHERE rbac_ua.usr_id = " . $this->db->quote($a_user_id, 'integer') . " " .
1377 "AND rbac_pa.ref_id = " . $this->db->quote($a_ref_id, 'integer') . " ";
1378
1379 $res = $this->db->query($query);
1380 $all_ops = [];
1381 while ($row = $this->db->fetchObject($res)) {
1382 $ops = unserialize($row->ops_id, ['allowed_classes' => false]);
1383 $all_ops = array_merge($all_ops, $ops);
1384 }
1385 $all_ops = array_unique($all_ops);
1386
1387 $set = $this->db->query("SELECT operation FROM rbac_operations " .
1388 " WHERE " . $this->db->in("ops_id", $all_ops, false, "integer"));
1389 $perms = [];
1390 while ($rec = $this->db->fetchAssoc($set)) {
1391 $perms[] = $rec["operation"];
1392 }
1393
1394 return array_values(array_filter($perms));
1395 }
1396
1400 public function setAssignedCacheEntry(int $a_role_id, int $a_user_id, bool $a_value): void
1401 {
1402 self::$is_assigned_cache[$a_role_id][$a_user_id] = $a_value;
1403 }
1404
1405 public function getAssignedCacheEntry(int $a_role_id, int $a_user_id): bool
1406 {
1407 return self::$is_assigned_cache[$a_role_id][$a_user_id];
1408 }
1409
1413 public function clearCaches(): void
1414 {
1415 self::$is_assigned_cache = [];
1416 self::$assigned_users_cache = [];
1417 }
1418
1419 public static function _getCustomRBACOperationId(string $operation, ?\ilDBInterface $ilDB = null): ?int
1420 {
1421 if (!$ilDB) {
1422 global $DIC;
1423 $ilDB = $DIC->database();
1424 }
1425
1426 $sql =
1427 "SELECT ops_id" . PHP_EOL
1428 . "FROM rbac_operations" . PHP_EOL
1429 . "WHERE operation = " . $ilDB->quote($operation, "text") . PHP_EOL
1430 ;
1431
1432 $res = $ilDB->query($sql);
1433 if ($ilDB->numRows($res) == 0) {
1434 return null;
1435 }
1436
1437 $row = $ilDB->fetchAssoc($res);
1438 return (int) $row["ops_id"] ?? null;
1439 }
1440
1441 public static function _isRBACOperation(int $type_id, int $ops_id, ?\ilDBInterface $ilDB = null): bool
1442 {
1443 if (!$ilDB) {
1444 global $DIC;
1445 $ilDB = $DIC->database();
1446 }
1447
1448 $sql =
1449 "SELECT typ_id" . PHP_EOL
1450 . "FROM rbac_ta" . PHP_EOL
1451 . "WHERE typ_id = " . $ilDB->quote($type_id, "integer") . PHP_EOL
1452 . "AND ops_id = " . $ilDB->quote($ops_id, "integer") . PHP_EOL
1453 ;
1454
1455 return (bool) $ilDB->numRows($ilDB->query($sql));
1456 }
1457} // END class.ilRbacReview
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
const FETCHMODE_OBJECT
const FETCHMODE_ASSOC
static _getAssignUsersStatus(int $a_role_id)
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
class ilRbacReview Contains Review functions of core Rbac.
getAssignableRoles(bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
Returns a list of all assignable roles.
buildRoleType(array $role_list_entry)
getAssignableRolesGenerator(bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
getTypeId(string $a_type)
isDeleted(int $a_node_id)
Checks if a rolefolder is set as deleted (negative tree_id)
static array $assigned_users_cache
getAssignedCacheEntry(int $a_role_id, int $a_user_id)
static _getOperationIdsByName(array $operations)
get ops_id's by name.
getRolesForIDs(array $role_ids, bool $use_templates)
hasMultipleAssignments(int $a_role_id)
isBlockedAtPosition(int $a_role_id, int $a_ref_id)
isRoleDeleted(int $a_role_id)
return if role is only attached to deleted role folders
getObjectReferenceOfRole(int $a_role_id)
static array $_opsCache
__getParentRoles(array $a_path, bool $a_templates)
Note: This function performs faster than the new getParentRoles function, because it uses database in...
__setRoleType(array $a_role_list)
computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in oth...
assignedRoles(int $a_usr_id)
get all assigned roles to a given user
getAssignableRolesInSubtree(int $ref_id)
Returns a list of assignable roles in a subtree of the repository.
getGlobalRoles()
get only 'global' roles
static lookupCreateOperationIds(array $a_type_arr)
Lookup operation ids.
getObjectsWithStopedInheritance(int $a_rol_id, array $a_filter=[])
get all objects in which the inheritance of role with role_id was stopped the function returns all re...
static _getCustomRBACOperationId(string $operation, ?\ilDBInterface $ilDB=null)
isProtected(int $a_ref_id, int $a_role_id)
ref_id not used yet.
isBlockedInUpperContext(int $a_role_id, int $a_ref_id)
Check if role is blocked in upper context.
getAllOperationsOfRole(int $a_rol_id, int $a_parent=0)
get all possible operations of a specific role The ref_id of the role folder (parent object) is neces...
setRoleTypeAndProtection(array $role_list_entry)
getAssignableChildRoles(int $a_ref_id)
Get all assignable roles directly under a specific node.
static _groupOperationsByClass(array $a_ops_arr)
getRolesOfObject(int $a_ref_id, bool $a_assignable_only=false)
Get roles of object.
getParentRoleIds(int $a_endnode_id, bool $a_templates=false)
Get an array of parent role ids of all parent roles, if last parameter is set true you get also all p...
roleExists(string $a_title, int $a_id=0)
Checks if a role already exists.
clearCaches()
Clear assigned users caches.
__setProtectedStatus(array $a_parent_roles, array $a_role_hierarchy, int $a_ref_id)
assignedUsers(int $a_rol_id)
get all assigned users to a given role
isAssignedToAtLeastOneGivenRole(int $a_usr_id, array $a_role_ids)
check if a specific user is assigned to at least one of the given role ids.
static _isRBACOperation(int $type_id, int $ops_id, ?\ilDBInterface $ilDB=null)
getUserPermissionsOnObject(int $a_user_id, int $a_ref_id)
Get all user permissions on an object.
getRoleFolderOfRole(int $a_role_id)
isAssigned(int $a_usr_id, int $a_role_id)
check if a specific user is assigned to specific role
__construct(protected ilDBInterface $db, protected LoggerInterface $log)
Constructor @access public.
getFoldersAssignedToRole(int $a_rol_id, bool $a_assignable=false)
Returns an array of objects assigned to a role.
getGlobalAssignableRoles()
get only 'global' roles (with flag 'assign_users')
getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
buildProtectionByStringValue(string $value)
isSystemGeneratedRole(int $a_role_id)
Check if the role is system generate role or role template.
__setTemplateFilter(bool $a_templates)
get roles and templates or only roles; returns string for where clause
getOperationsOfRole(int $a_rol_id, string $a_type, int $a_parent=0)
get all possible operations of a specific role The ref_id of the role folder (parent object) is neces...
getNumberOfAssignedUsers(array $a_roles)
Get the number of assigned users to roles (not properly deleted user accounts are not counted)
isRoleAssignedToObject(int $a_role_id, int $a_parent_id)
Check if role is assigned to an object.
assignedGlobalRoles(int $a_usr_id)
Get assigned global roles for an user.
getLocalPolicies(int $a_ref_id)
Get all roles with local policies.
isAssignable(int $a_rol_id, int $a_ref_id)
Check if its possible to assign users.
getRoleListByObject(int $a_ref_id, bool $a_templates=false)
Returns a list of roles in an container.
static array $is_assigned_cache
getOperationsOnTypeString(string $a_type)
all possible operations of a type
getOperation(int $ops_id)
get one operation by operation id
getGlobalRolesArray()
get only 'global' roles
getRolesByFilter(int $a_filter=0, int $a_user_id=0, string $title_filter='')
setAssignedCacheEntry(int $a_role_id, int $a_user_id, bool $a_value)
set entry of assigned_chache
getOperationsByTypeAndClass(string $a_type, string $a_class)
Get operations by type and class.
getOperationAssignment()
get operation assignments
getActiveOperationsOfRole(int $a_ref_id, int $a_role_id)
isGlobalRole(int $a_role_id)
Check if role is a global role.
getRoleOperationsOnObject(int $a_role_id, int $a_ref_id)
getObjectOfRole(int $a_role_id)
Get object id of objects a role is assigned to.
getOperations()
get all possible operations
getLocalRoles(int $a_ref_id)
Get local roles of object.
getOperationsOnType(int $a_typ_id)
all possible operations of a type
static _getOperationIdByName(string $a_operation)
get operation id by name of operation
static _getOperationList(string $a_type='')
get operation list by object type
isDeleteable(int $a_role_id, int $a_rolf_id)
Check if role is deleteable at a specific position.
const SYSTEM_ROLE_ID
Definition: constants.php:29
const ANONYMOUS_ROLE_ID
Definition: constants.php:28
const ROLE_FOLDER_ID
Definition: constants.php:34
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$info
Definition: entry_point.php:21
Interface ilDBInterface.
$log
Definition: ltiauth.php:50
foreach($_POST as $key=> $value) $res
global $DIC
Definition: shib_login.php:26