19 declare(strict_types=1);
60 $this->db = $DIC->database();
74 $q =
"SELECT DISTINCT(obj_id) obj_id FROM object_data " .
76 "AND type IN('role','rolt')" .
78 $r = $this->db->query(
$q);
80 return (
int) $row->obj_id;
101 foreach ($roles as $role) {
102 $id = (
int) $role[
"obj_id"];
103 $role[
"parent"] = (
int) $ref_id;
104 $parent_roles[
$id] = $role;
106 if (!array_key_exists($role[
'obj_id'], $role_hierarchy)) {
126 $tree = $DIC->repositoryTree();
128 $pathIds = $tree->getPathId($a_endnode_id);
145 $query =
"SELECT * FROM object_data " .
146 "JOIN rbac_fa ON obj_id = rol_id " .
148 "AND object_data.obj_id = rbac_fa.rol_id " .
149 "AND rbac_fa.parent = " . $this->db->quote($a_ref_id,
'integer') .
" ";
151 $res = $this->db->query($query);
152 while ($row = $this->db->fetchAssoc(
$res)) {
153 $row[
"desc"] = $row[
"description"];
154 $row[
"user_id"] = (
int) $row[
"owner"];
155 $row[
'obj_id'] = (
int) $row[
'obj_id'];
156 $row[
'rol_id'] = (
int) $row[
'rol_id'];
157 $row[
'parent'] = (
int) $row[
'parent'];
169 bool $a_templates =
false,
170 bool $a_internal_roles =
false,
171 string $title_filter =
'' 173 return iterator_to_array(
186 bool $a_templates =
false,
187 bool $a_internal_roles =
false,
188 string $title_filter =
'' 191 $query =
"SELECT * FROM object_data " .
192 "JOIN rbac_fa ON obj_id = rol_id " .
194 "AND rbac_fa.assign = 'y' ";
196 if (strlen($title_filter)) {
197 $query .= (
' AND ' . $this->db->like(
203 $res = $this->db->query($query);
205 while ($row = $this->db->fetchAssoc(
$res)) {
206 $row[
"description"] = (string) $row[
"description"];
207 $row[
"desc"] = $row[
"description"];
208 $row[
"user_id"] = (
int) $row[
"owner"];
209 $row[
'obj_id'] = (
int) $row[
'obj_id'];
210 $row[
'parent'] = (
int) $row[
'parent'];
224 $tree = $DIC->repositoryTree();
225 $query =
'SELECT rol_id FROM rbac_fa fa ' .
226 'JOIN tree t1 ON t1.child = fa.parent ' .
227 'JOIN object_data obd ON fa.rol_id = obd.obj_id ' .
228 'WHERE assign = ' . $this->db->quote(
'y',
'text') .
' ' .
229 'AND obd.type = ' . $this->db->quote(
'role',
'text') .
' ' .
230 'AND t1.child IN (' .
231 $tree->getSubTreeQuery($ref_id, [
'child']) .
' ' .
234 $res = $this->db->query($query);
238 $role_list[] = (
int) $row->rol_id;
248 $query =
"SELECT fa.*, rd.* " .
249 "FROM object_data rd " .
250 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id " .
251 "WHERE fa.assign = 'y' " .
252 "AND fa.parent = " . $this->db->quote($a_ref_id,
'integer') .
" ";
254 $res = $this->db->query($query);
256 while ($row = $this->db->fetchAssoc(
$res)) {
257 $row[
'rol_id'] = (
int) $row[
'rol_id'];
258 $row[
'obj_id'] = (
int) $row[
'obj_id'];
260 $roles_data[] = $row;
272 $where =
"WHERE " . $this->db->in(
'object_data.type', [
'role',
'rolt'],
false,
'text') .
" ";
274 $where =
"WHERE " . $this->db->in(
'object_data.type', [
'role'],
false,
'text') .
" ";
288 foreach ($a_role_list as $key => $val) {
296 $role_list_entry[
'role_type'] = $this->
buildRoleType($role_list_entry);
298 return $role_list_entry;
303 if ($role_list_entry[
'type'] ===
'rolt') {
307 if ($role_list_entry[
'assign'] !==
'y') {
320 if ($value ===
'y') {
332 $query =
'select count(distinct(ua.usr_id)) as num from rbac_ua ua ' .
333 'join object_data on ua.usr_id = obj_id ' .
334 'join usr_data ud on ua.usr_id = ud.usr_id ' .
335 'where ' . $this->db->in(
'rol_id', $a_roles,
false,
'integer');
337 $res = $this->db->query($query);
338 if (
$res->numRows() > 0) {
340 return isset($row->num) && is_numeric($row->num) ? (
int) $row->num : 0;
351 if (isset(self::$assigned_users_cache[$a_rol_id])) {
352 return self::$assigned_users_cache[$a_rol_id];
356 $query =
"SELECT usr_id FROM rbac_ua WHERE rol_id= " . $this->db->quote($a_rol_id,
'integer');
357 $res = $this->db->query($query);
358 while ($row = $this->db->fetchAssoc(
$res)) {
359 $result_arr[] = (
int) $row[
"usr_id"];
361 self::$assigned_users_cache[$a_rol_id] = $result_arr;
368 public function isAssigned(
int $a_usr_id,
int $a_role_id): bool
370 if (isset(self::$is_assigned_cache[$a_role_id][$a_usr_id])) {
371 return self::$is_assigned_cache[$a_role_id][$a_usr_id];
374 $this->db->setLimit(1, 0);
375 $query =
"SELECT usr_id FROM rbac_ua WHERE " .
376 "rol_id= " . $this->db->quote($a_role_id,
'integer') .
" " .
378 $res = $this->db->query($query);
379 $is_assigned =
$res->numRows() == 1;
380 self::$is_assigned_cache[$a_role_id][$a_usr_id] = $is_assigned;
396 $this->db = $DIC[
'ilDB'];
398 $this->db->setLimit(1, 0);
399 $query =
"SELECT usr_id FROM rbac_ua WHERE " .
400 $this->db->in(
'rol_id', $a_role_ids,
false,
'integer') .
402 $res = $this->db->query($query);
404 return $this->db->numRows(
$res) == 1;
413 $query =
"SELECT rol_id FROM rbac_ua WHERE usr_id = " . $this->db->quote($a_usr_id,
'integer');
415 $res = $this->db->query($query);
417 while ($row = $this->db->fetchObject(
$res)) {
418 $role_arr[] = (
int) $row->rol_id;
429 $query =
"SELECT ua.rol_id FROM rbac_ua ua " .
430 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
431 "WHERE usr_id = " . $this->db->quote($a_usr_id,
'integer') .
' ' .
435 $res = $this->db->query($query);
437 while ($row = $this->db->fetchObject(
$res)) {
438 $role_arr[] = (
int) $row->rol_id;
454 $query =
"SELECT * FROM rbac_fa " .
455 "WHERE rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " .
456 "AND parent = " . $this->db->quote($a_ref_id,
'integer') .
" ";
457 $res = $this->db->query($query);
458 while ($row = $this->db->fetchObject(
$res)) {
459 return $row->assign ==
'y';
466 $query =
"SELECT * FROM rbac_fa WHERE rol_id = " . $this->db->quote($a_role_id,
'integer') .
' ' .
467 "AND assign = " . $this->db->quote(
'y',
'text');
468 $res = $this->db->query($query);
469 return $res->numRows() > 1;
485 $where =
" AND assign ='y'";
488 $query =
"SELECT DISTINCT parent FROM rbac_fa " .
489 "WHERE rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " . $where .
" ";
491 $res = $this->db->query($query);
493 while ($row = $this->db->fetchObject(
$res)) {
494 $folders[] = (
int) $row->parent;
506 if ($a_assignable_only ===
true) {
507 $and =
'AND assign = ' . $this->db->quote(
'y',
'text');
509 $query =
"SELECT rol_id FROM rbac_fa " .
510 "WHERE parent = " . $this->db->quote($a_ref_id,
'integer') .
" " .
513 $res = $this->db->query($query);
516 while ($row = $this->db->fetchObject(
$res)) {
517 $role_ids[] = (
int) $row->rol_id;
532 if ($a_nonassignable ===
false) {
533 $and =
" AND assign='y'";
536 $query =
"SELECT rol_id FROM rbac_fa " .
537 "WHERE parent = " . $this->db->quote($a_ref_id,
'integer') .
" " .
540 $res = $this->db->query($query);
542 while ($row = $this->db->fetchObject(
$res)) {
543 $rol_id[] = (
int) $row->rol_id;
568 $lroles[] = $role_id;
582 $lroles[] = $role_id;
595 $ga[] = [
'obj_id' => $role_id,
596 'role_type' =>
'global' 611 $ga[] = [
'obj_id' => $role_id,
612 'role_type' =>
'global' 624 $query =
'SELECT * FROM rbac_fa ' .
625 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
626 'AND parent = ' . $this->db->quote($a_parent_id,
'integer');
627 $res = $this->db->query($query);
628 return (
bool)
$res->numRows();
637 $query =
'SELECT * FROM rbac_operations ORDER BY ops_id ';
638 $res = $this->db->query($query);
640 while ($row = $this->db->fetchObject(
$res)) {
641 $ops[] = [
'ops_id' => (
int) $row->ops_id,
642 'operation' => $row->operation,
643 'description' => $row->description
655 $query =
'SELECT * FROM rbac_operations WHERE ops_id = ' . $this->db->quote($ops_id,
'integer');
656 $res = $this->db->query($query);
658 while ($row = $this->db->fetchObject(
$res)) {
659 $ops = [
'ops_id' => (
int) $row->ops_id,
660 'operation' => $row->operation,
661 'description' => $row->description
677 $query =
"SELECT ops_id,type FROM rbac_templates " .
678 "WHERE rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " .
679 "AND parent = " . $this->db->quote($a_parent,
'integer');
680 $res = $this->db->query($query);
683 while ($row = $this->db->fetchObject(
$res)) {
684 $ops_arr[$row->type][] = (
int) $row->ops_id;
694 $query =
'SELECT * FROM rbac_pa ' .
695 'WHERE ref_id = ' . $this->db->quote($a_ref_id,
'integer') .
' ' .
696 'AND rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ';
698 $res = $this->db->query($query);
702 $row[
'ops_id'] ===
':' ? [] : unserialize($row[
'ops_id'], [
'allowed_classes' =>
false])
717 if ($a_parent == 0) {
721 $query =
"SELECT ops_id FROM rbac_templates " .
722 "WHERE type =" . $this->db->quote($a_type,
'text') .
" " .
723 "AND rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " .
724 "AND parent = " . $this->db->quote($a_parent,
'integer');
725 $res = $this->db->query($query);
726 while ($row = $this->db->fetchObject(
$res)) {
727 $ops_arr[] = $row->ops_id;
737 $query =
"SELECT ops_id FROM rbac_pa " .
738 "WHERE rol_id = " . $this->db->quote($a_role_id,
'integer') .
" " .
739 "AND ref_id = " . $this->db->quote($a_ref_id,
'integer') .
" ";
741 $res = $this->db->query($query);
743 while ($row = $this->db->fetchObject(
$res)) {
744 if ($row->ops_id !==
':') {
747 unserialize($row->ops_id, [
'allowed_classes' =>
false])
761 $query =
'SELECT ta.ops_id FROM rbac_ta ta JOIN rbac_operations o ON ta.ops_id = o.ops_id ' .
762 'WHERE typ_id = ' . $this->db->quote($a_typ_id,
'integer') .
' ' .
765 $res = $this->db->query($query);
767 while ($row = $this->db->fetchObject(
$res)) {
768 $ops_id[] = (
int) $row->ops_id;
779 $query =
"SELECT * FROM object_data WHERE type = 'typ' AND title = " . $this->db->quote($a_type,
'text') .
" ";
780 $res = $this->db->query($query);
793 if ($a_class !=
'create') {
794 $condition =
"AND class != " . $this->db->quote(
'create',
'text');
796 $condition =
"AND class = " . $this->db->quote(
'create',
'text');
799 $query =
"SELECT ro.ops_id FROM rbac_operations ro " .
800 "JOIN rbac_ta rt ON ro.ops_id = rt.ops_id " .
801 "JOIN object_data od ON rt.typ_id = od.obj_id " .
802 "WHERE type = " . $this->db->quote(
'typ',
'text') .
" " .
803 "AND title = " . $this->db->quote($a_type,
'text') .
" " .
805 "ORDER BY op_order ";
807 $res = $this->db->query($query);
810 $ops[] = (
int) $row->ops_id;
822 $query =
'SELECT parent p FROM rbac_fa ' .
823 'WHERE assign = ' . $this->db->quote(
'n',
'text') .
' ' .
824 'AND rol_id = ' . $this->db->quote($a_rol_id,
'integer') .
' ';
826 if ($a_filter !== []) {
827 $query .= (
'AND ' . $this->db->in(
'parent', (array) $a_filter,
false,
'integer'));
830 $res = $this->db->query($query);
833 $parent[] = (
int) $row->p;
845 $r = $this->db->query(
$q);
850 '%s::isDeleted(): Role folder with ref_id %s not found!',
857 return $row->tree < 0;
875 case self::FILTER_ALL:
878 case self::FILTER_ALL_GLOBAL:
879 $where =
'WHERE ' . $this->db->in(
'rbac_fa.rol_id', $this->
getGlobalRoles(),
false,
'integer') .
' ';
882 case self::FILTER_ALL_LOCAL:
883 case self::FILTER_INTERNAL:
884 case self::FILTER_NOT_INTERNAL:
885 $where =
'WHERE ' . $this->db->in(
'rbac_fa.rol_id', $this->
getGlobalRoles(),
true,
'integer');
888 case self::FILTER_TEMPLATES:
889 $where =
"WHERE object_data.type = 'rolt'";
899 $where =
'WHERE ' . $this->db->in(
908 $query =
"SELECT * FROM object_data " .
909 "JOIN rbac_fa ON obj_id = rol_id " .
911 "AND rbac_fa.assign = " . $this->db->quote($assign,
'text') .
" ";
913 if (strlen($title_filter)) {
914 $query .= (
' AND ' . $this->db->like(
917 '%' . $title_filter .
'%' 921 $res = $this->db->query($query);
922 while ($row = $this->db->fetchAssoc(
$res)) {
923 $row[
'title'] = $row[
'title'] ??
'';
924 $prefix = str_starts_with($row[
'title'],
"il_");
927 if ($a_filter == 4 && !$prefix) {
932 if ($a_filter == 5 && $prefix) {
936 $row[
'description'] = $row[
'description'] ??
'';
937 $row[
"desc"] = $row[
"description"];
938 $row[
"user_id"] = (
int) $row[
"owner"];
939 $row[
'obj_id'] = (
int) $row[
'obj_id'];
940 $row[
'rol_id'] = (
int) $row[
'rol_id'];
941 $row[
'parent'] = (
int) $row[
'parent'];
949 $q =
"SELECT obj_id FROM object_data " .
950 "WHERE title=" . $this->db->quote($a_type,
'text') .
" AND type='typ'";
951 $r = $this->db->query(
$q);
953 return (
int) $row->obj_id;
968 $ilDB = $DIC->database();
969 if ($operations === []) {
973 $query =
'SELECT ops_id FROM rbac_operations ' .
974 'WHERE ' .
$ilDB->in(
'operation', $operations,
false,
'text');
978 while ($row =
$ilDB->fetchObject(
$res)) {
979 $ops_ids[] = (
int) $row->ops_id;
991 $ilDB = $DIC->database();
994 if (!is_array(self::$_opsCache)) {
995 self::$_opsCache = [];
997 $q =
"SELECT ops_id, operation FROM rbac_operations";
1000 self::$_opsCache[$row->operation] = (
int) $row->ops_id;
1005 if (array_key_exists($a_operation, self::$_opsCache)) {
1006 return self::$_opsCache[$a_operation];
1020 $ilDB = $DIC->database();
1023 foreach ($a_type_arr as $type) {
1024 $operations[] = (
'create_' . $type);
1027 if ($operations === []) {
1031 $query =
'SELECT ops_id, operation FROM rbac_operations ' .
1032 'WHERE ' .
$ilDB->in(
'operation', $operations,
false,
'text');
1037 while ($row =
$ilDB->fetchObject(
$res)) {
1038 $type_arr = explode(
'_', $row->operation);
1039 $type = $type_arr[1];
1041 $ops_ids[$type] = (
int) $row->ops_id;
1051 $query =
'SELECT protected FROM rbac_fa ' .
1053 $res = $this->db->query($query);
1055 if ($row->protected ===
'y') {
1064 $query =
'SELECT blocked from rbac_fa ' .
1065 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1066 'AND parent = ' . $this->db->quote($a_ref_id,
'integer');
1067 $res = $this->db->query($query);
1069 return (
bool) $row->blocked;
1082 $tree = $DIC[
'tree'];
1087 $query =
'SELECT parent from rbac_fa ' .
1088 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1089 'AND blocked = ' . $this->db->quote(1,
'integer');
1090 $res = $this->db->query($query);
1094 $parent_ids[] = (
int) $row->parent;
1097 foreach ($parent_ids as $parent_id) {
1098 if ($tree->isGrandChild($parent_id, $a_ref_id)) {
1111 $rbacsystem = $DIC->rbac()->system();
1112 $ilUser = $DIC->user();
1116 $leveladmin =
false;
1118 foreach ($a_role_hierarchy as $role_id => $rolf_id) {
1119 if ($leveladmin ==
true) {
1120 $a_parent_roles[$role_id][
'protected'] =
false;
1124 if ($a_parent_roles[$role_id][
'protected'] ==
true) {
1125 $arr_lvl_roles_user = array_intersect(
1127 array_keys($a_role_hierarchy, $rolf_id)
1130 foreach ($arr_lvl_roles_user as $lvl_role_id) {
1132 $rolf = $a_parent_roles[$role_id][
'parent'];
1133 if ($rbacsystem->checkPermission($rolf, $lvl_role_id,
'edit_permission')) {
1134 $a_parent_roles[$role_id][
'protected'] =
false;
1139 return $a_parent_roles;
1150 $ilDB = $DIC->database();
1154 'SELECT * FROM rbac_operations ' .
1155 'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id ' .
1156 'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id ' .
1157 'WHERE object_data.title = %s ' .
1158 'AND object_data.type = %s ' .
1159 'ORDER BY op_order ASC',
1160 $ilDB->quote($a_type,
'text'),
1161 $ilDB->quote(
'typ',
'text')
1164 $query =
'SELECT * FROM rbac_operations ORDER BY op_order ASC';
1167 while ($row =
$ilDB->fetchAssoc(
$res)) {
1169 "ops_id" => (
int) $row[
'ops_id'],
1170 "operation" => $row[
'operation'],
1171 "desc" => $row[
'description'],
1172 "class" => $row[
'class'],
1173 "order" => (
int) $row[
'op_order']
1185 foreach ($a_ops_arr as $ops) {
1186 $arr[$ops[
'class']][] = [
'ops_id' => (
int) $ops[
'ops_id'],
1187 'name' => $ops[
'operation']
1200 static $obj_cache = [];
1202 if (isset($obj_cache[$a_role_id]) && $obj_cache[$a_role_id]) {
1203 return $obj_cache[$a_role_id];
1206 $query =
'SELECT obr.obj_id FROM rbac_fa rfa ' .
1207 'JOIN object_reference obr ON rfa.parent = obr.ref_id ' .
1208 'WHERE assign = ' . $this->db->quote(
'y',
'text') .
' ' .
1209 'AND rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1210 'AND deleted IS NULL';
1212 $res = $this->db->query($query);
1213 $obj_cache[$a_role_id] = 0;
1214 while ($row = $this->db->fetchObject(
$res)) {
1215 $obj_cache[$a_role_id] = (
int) $row->obj_id;
1217 return $obj_cache[$a_role_id];
1222 $query =
'SELECT parent p_ref FROM rbac_fa ' .
1223 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1224 'AND assign = ' . $this->db->quote(
'y',
'text');
1226 $res = $this->db->query($query);
1228 return (
int) $row->p_ref;
1240 if ($rolf_list !== []) {
1241 foreach ($rolf_list as $rolf) {
1255 $query =
"SELECT * FROM object_data " .
1256 "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id " .
1258 "AND rbac_fa.assign = 'y' " .
1259 'AND ' . $this->db->in(
'object_data.obj_id', $role_ids,
false,
'integer');
1261 $res = $this->db->query($query);
1263 while ($row = $this->db->fetchAssoc(
$res)) {
1264 $row[
"desc"] = $row[
"description"];
1265 $row[
"user_id"] = (
int) $row[
"owner"];
1266 $role_list[] = $row;
1279 $this->db = $DIC[
'ilDB'];
1281 $query =
'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta ' .
1282 'JOIN object_data obj ON obj.obj_id = ta.typ_id ' .
1283 'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1284 $res = $this->db->query($query);
1288 while ($row = $this->db->fetchObject(
$res)) {
1289 $info[$counter][
'typ_id'] = (
int) $row->typ_id;
1290 $info[$counter][
'type'] = $row->title;
1291 $info[$counter][
'ops_id'] = (
int) $row->ops_id;
1292 $info[$counter][
'operation'] = $row->operation;
1296 return array_values($info);
1322 return substr($title, 0, 3) ==
'il_';
1325 public function getParentOfRole(
int $role_id, ?
int $object_ref =
null): ?
int 1329 $tree = $DIC[
'tree'];
1336 $path_ids = $tree->getPathId($object_ref);
1339 while (
$ref_id = array_pop($path_ids)) {
1341 foreach ($roles as $role) {
1342 if ((
int) $role[
'obj_id'] === $role_id) {
1355 $and = (
'AND assign = ' . $this->db->quote(
'y',
'text'));
1360 $query =
'SELECT * FROM rbac_fa ' .
1361 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1363 $res = $this->db->query($query);
1365 return (
int) $row->parent;
1376 $query =
"SELECT ops_id FROM rbac_pa JOIN rbac_ua " .
1377 "ON (rbac_pa.rol_id = rbac_ua.rol_id) " .
1378 "WHERE rbac_ua.usr_id = " . $this->db->quote($a_user_id,
'integer') .
" " .
1379 "AND rbac_pa.ref_id = " . $this->db->quote($a_ref_id,
'integer') .
" ";
1381 $res = $this->db->query($query);
1383 while ($row = $this->db->fetchObject(
$res)) {
1384 $ops = unserialize($row->ops_id, [
'allowed_classes' =>
false]);
1385 $all_ops = array_merge($all_ops, $ops);
1387 $all_ops = array_unique($all_ops);
1389 $set = $this->db->query(
"SELECT operation FROM rbac_operations " .
1390 " WHERE " . $this->db->in(
"ops_id", $all_ops,
false,
"integer"));
1392 while ($rec = $this->db->fetchAssoc($set)) {
1393 $perms[] = $rec[
"operation"];
1396 return array_values(array_filter($perms));
1404 self::$is_assigned_cache[$a_role_id][$a_user_id] = $a_value;
1409 return self::$is_assigned_cache[$a_role_id][$a_user_id];
1417 self::$is_assigned_cache = [];
1418 self::$assigned_users_cache = [];
1425 $ilDB = $DIC->database();
1429 "SELECT ops_id" . PHP_EOL
1430 .
"FROM rbac_operations" . PHP_EOL
1431 .
"WHERE operation = " .
$ilDB->quote($operation,
"text") . PHP_EOL
1440 return (
int) $row[
"ops_id"] ??
null;
1447 $ilDB = $DIC->database();
1451 "SELECT typ_id" . PHP_EOL
1452 .
"FROM rbac_ta" . PHP_EOL
1453 .
"WHERE typ_id = " .
$ilDB->quote($type_id,
"integer") . PHP_EOL
1454 .
"AND ops_id = " .
$ilDB->quote($ops_id,
"integer") . PHP_EOL
1457 return (
bool)
$ilDB->numRows(
$ilDB->query($sql));
getRoleListByObject(int $a_ref_id, bool $a_templates=false)
Returns a list of roles in an container.
clearCaches()
Clear assigned users caches.
getOperationsOnType(int $a_typ_id)
all possible operations of a type
static _getCustomRBACOperationId(string $operation, ?\ilDBInterface $ilDB=null)
getRolesForIDs(array $role_ids, bool $use_templates)
roleExists(string $a_title, int $a_id=0)
Checks if a role already exists.
static getLogger(string $a_component_id)
Get component logger.
getRoleOperationsOnObject(int $a_role_id, int $a_ref_id)
assignedUsers(int $a_rol_id)
get all assigned users to a given role
getOperation(int $ops_id)
get one operation by operation id
isBlockedAtPosition(int $a_role_id, int $a_ref_id)
getUserPermissionsOnObject(int $a_user_id, int $a_ref_id)
Get all user permissions on an object.
getRolesOfObject(int $a_ref_id, bool $a_assignable_only=false)
Get roles of object.
setRoleTypeAndProtection(array $role_list_entry)
getOperationsOnTypeString(string $a_type)
all possible operations of a type
getLocalRoles(int $a_ref_id)
Get local roles of object.
__setTemplateFilter(bool $a_templates)
get roles and templates or only roles; returns string for where clause
isSystemGeneratedRole(int $a_role_id)
Check if the role is system generate role or role template.
static _getOperationIdsByName(array $operations)
get ops_id's by name.
getObjectReferenceOfRole(int $a_role_id)
getOperationAssignment()
get operation assignments
const FILTER_NOT_INTERNAL
__setRoleType(array $a_role_list)
computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in oth...
isDeleted(int $a_node_id)
Checks if a rolefolder is set as deleted (negative tree_id)
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...
setAssignedCacheEntry(int $a_role_id, int $a_user_id, bool $a_value)
set entry of assigned_chache
getLocalPolicies(int $a_ref_id)
Get all roles with local policies.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__getParentRoles(array $a_path, bool $a_templates)
Note: This function performs faster than the new getParentRoles function, because it uses database in...
static _getOperationList(string $a_type='')
get operation list by object type
static lookupCreateOperationIds(array $a_type_arr)
Lookup operation ids.
getOperationsByTypeAndClass(string $a_type, string $a_class)
Get operations by type and class.
getFoldersAssignedToRole(int $a_rol_id, bool $a_assignable=false)
Returns an array of objects assigned to a role.
static array $is_assigned_cache
getGlobalRolesArray()
get only 'global' roles
getAssignableChildRoles(int $a_ref_id)
Get all assignable roles directly under a specific node.
static _lookupTitle(int $obj_id)
static _isRBACOperation(int $type_id, int $ops_id, ?\ilDBInterface $ilDB=null)
isRoleAssignedToObject(int $a_role_id, int $a_parent_id)
Check if role is assigned to an object.
getTypeId(string $a_type)
buildRoleType(array $role_list_entry)
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...
isAssigned(int $a_usr_id, int $a_role_id)
check if a specific user is assigned to specific role
isDeleteable(int $a_role_id, int $a_rolf_id)
Check if role is deleteable at a specific position.
getGlobalRoles()
get only 'global' roles
getAssignableRolesInSubtree(int $ref_id)
Returns a list of assignable roles in a subtree of the repository.
getNumberOfAssignedUsers(array $a_roles)
Get the number of assigned users to roles (not properly deleted user accounts are not counted) ...
__setProtectedStatus(array $a_parent_roles, array $a_role_hierarchy, int $a_ref_id)
hasMultipleAssignments(int $a_role_id)
isBlockedInUpperContext(int $a_role_id, int $a_ref_id)
Check if role is blocked in upper context.
isGlobalRole(int $a_role_id)
Check if role is a global role.
static _getOperationIdByName(string $a_operation)
get operation id by name of operation
getGlobalAssignableRoles()
get only 'global' roles (with flag 'assign_users')
__construct()
Constructor public.
getOperations()
get all possible operations
static _groupOperationsByClass(array $a_ops_arr)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getAssignableRolesGenerator(bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
getAssignedCacheEntry(int $a_role_id, int $a_user_id)
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...
assignedGlobalRoles(int $a_usr_id)
Get assigned global roles for an user.
getActiveOperationsOfRole(int $a_ref_id, int $a_role_id)
isRoleDeleted(int $a_role_id)
return if role is only attached to deleted role folders
static _getAssignUsersStatus(int $a_role_id)
isAssignable(int $a_rol_id, int $a_ref_id)
Check if its possible to assign users.
static _lookupType(int $id, bool $reference=false)
getRolesByFilter(int $a_filter=0, int $a_user_id=0, string $title_filter='')
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...
getRoleFolderOfRole(int $a_role_id)
getAssignableRoles(bool $a_templates=false, bool $a_internal_roles=false, string $title_filter='')
Returns a list of all assignable roles.
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...
buildProtectionByStringValue(string $value)
assignedRoles(int $a_usr_id)
get all assigned roles to a given user
getObjectOfRole(int $a_role_id)
Get object id of objects a role is assigned to.
static array $assigned_users_cache
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.
isProtected(int $a_ref_id, int $a_role_id)
ref_id not used yet.