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'];
223 $tree = $DIC->repositoryTree();
224 $query =
'SELECT rol_id FROM rbac_fa fa ' .
225 'JOIN tree t1 ON t1.child = fa.parent ' .
226 'JOIN object_data obd ON fa.rol_id = obd.obj_id ' .
227 'WHERE assign = ' . $this->db->quote(
'y',
'text') .
' ' .
228 'AND obd.type = ' . $this->db->quote(
'role',
'text') .
' ' .
229 'AND t1.child IN (' .
230 $tree->getSubTreeQuery($ref_id, [
'child']) .
' ' .
233 $res = $this->db->query($query);
237 $role_list[] = (
int) $row->rol_id;
247 $query =
"SELECT fa.*, rd.* " .
248 "FROM object_data rd " .
249 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id " .
250 "WHERE fa.assign = 'y' " .
251 "AND fa.parent = " . $this->db->quote($a_ref_id,
'integer') .
" ";
253 $res = $this->db->query($query);
255 while ($row = $this->db->fetchAssoc(
$res)) {
256 $row[
'rol_id'] = (
int) $row[
'rol_id'];
257 $row[
'obj_id'] = (
int) $row[
'obj_id'];
259 $roles_data[] = $row;
271 $where =
"WHERE " . $this->db->in(
'object_data.type', [
'role',
'rolt'],
false,
'text') .
" ";
273 $where =
"WHERE " . $this->db->in(
'object_data.type', [
'role'],
false,
'text') .
" ";
287 foreach ($a_role_list as
$key => $val) {
295 $role_list_entry[
'role_type'] = $this->
buildRoleType($role_list_entry);
297 return $role_list_entry;
302 if ($role_list_entry[
'type'] ===
'rolt') {
306 if ($role_list_entry[
'assign'] !==
'y') {
319 if ($value ===
'y') {
331 $query =
'select count(distinct(ua.usr_id)) as num from rbac_ua ua ' .
332 'join object_data on ua.usr_id = obj_id ' .
333 'join usr_data ud on ua.usr_id = ud.usr_id ' .
334 'where ' . $this->db->in(
'rol_id', $a_roles,
false,
'integer');
336 $res = $this->db->query($query);
337 if (
$res->numRows() > 0) {
339 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;
414 $query =
"SELECT rol_id FROM rbac_ua WHERE usr_id = " . $this->db->quote($a_usr_id,
'integer');
416 $res = $this->db->query($query);
418 while ($row = $this->db->fetchObject(
$res)) {
419 $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[] = $row->rol_id;
440 return $role_arr !== [] ? $role_arr : [];
453 $query =
"SELECT * FROM rbac_fa " .
454 "WHERE rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " .
455 "AND parent = " . $this->db->quote($a_ref_id,
'integer') .
" ";
456 $res = $this->db->query($query);
457 while ($row = $this->db->fetchObject(
$res)) {
458 return $row->assign ==
'y';
465 $query =
"SELECT * FROM rbac_fa WHERE rol_id = " . $this->db->quote($a_role_id,
'integer') .
' ' .
466 "AND assign = " . $this->db->quote(
'y',
'text');
467 $res = $this->db->query($query);
468 return $res->numRows() > 1;
484 $where =
" AND assign ='y'";
487 $query =
"SELECT DISTINCT parent FROM rbac_fa " .
488 "WHERE rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " . $where .
" ";
490 $res = $this->db->query($query);
492 while ($row = $this->db->fetchObject(
$res)) {
493 $folders[] = (
int) $row->parent;
504 if ($a_assignable_only ===
true) {
505 $and =
'AND assign = ' . $this->db->quote(
'y',
'text');
507 $query =
"SELECT rol_id FROM rbac_fa " .
508 "WHERE parent = " . $this->db->quote($a_ref_id,
'integer') .
" " .
511 $res = $this->db->query($query);
514 while ($row = $this->db->fetchObject(
$res)) {
515 $role_ids[] = (
int) $row->rol_id;
533 if ($a_nonassignable ===
false) {
534 $and =
" AND assign='y'";
537 $query =
"SELECT rol_id FROM rbac_fa " .
538 "WHERE parent = " . $this->db->quote($a_ref_id,
'integer') .
" " .
541 $res = $this->db->query($query);
543 while ($row = $this->db->fetchObject(
$res)) {
544 $rol_id[] = (
int) $row->rol_id;
568 $lroles[] = $role_id;
582 $lroles[] = $role_id;
594 $ga[] = [
'obj_id' => $role_id,
595 'role_type' =>
'global' 609 $ga[] = [
'obj_id' => $role_id,
610 'role_type' =>
'global' 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();
634 $query =
'SELECT * FROM rbac_operations ORDER BY ops_id ';
635 $res = $this->db->query($query);
637 while ($row = $this->db->fetchObject(
$res)) {
638 $ops[] = [
'ops_id' => (
int) $row->ops_id,
639 'operation' => $row->operation,
640 'description' => $row->description
651 $query =
'SELECT * FROM rbac_operations WHERE ops_id = ' . $this->db->quote($ops_id,
'integer');
652 $res = $this->db->query($query);
654 while ($row = $this->db->fetchObject(
$res)) {
655 $ops = [
'ops_id' => (
int) $row->ops_id,
656 'operation' => $row->operation,
657 'description' => $row->description
672 $query =
"SELECT ops_id,type FROM rbac_templates " .
673 "WHERE rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " .
674 "AND parent = " . $this->db->quote($a_parent,
'integer');
675 $res = $this->db->query($query);
678 while ($row = $this->db->fetchObject(
$res)) {
679 $ops_arr[$row->type][] = (
int) $row->ops_id;
689 $query =
'SELECT * FROM rbac_pa ' .
690 'WHERE ref_id = ' . $this->db->quote($a_ref_id,
'integer') .
' ' .
691 'AND rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ';
693 $res = $this->db->query($query);
695 return $row[
'ops_id'] ===
':' ? [] : unserialize($row[
'ops_id']);
708 if ($a_parent == 0) {
712 $query =
"SELECT ops_id FROM rbac_templates " .
713 "WHERE type =" . $this->db->quote($a_type,
'text') .
" " .
714 "AND rol_id = " . $this->db->quote($a_rol_id,
'integer') .
" " .
715 "AND parent = " . $this->db->quote($a_parent,
'integer');
716 $res = $this->db->query($query);
717 while ($row = $this->db->fetchObject(
$res)) {
718 $ops_arr[] = $row->ops_id;
725 $query =
"SELECT ops_id FROM rbac_pa " .
726 "WHERE rol_id = " . $this->db->quote($a_role_id,
'integer') .
" " .
727 "AND ref_id = " . $this->db->quote($a_ref_id,
'integer') .
" ";
729 $res = $this->db->query($query);
731 while ($row = $this->db->fetchObject(
$res)) {
732 if ($row->ops_id !==
':') {
733 $ops = unserialize($row->ops_id);
744 $query =
'SELECT ta.ops_id FROM rbac_ta ta JOIN rbac_operations o ON ta.ops_id = o.ops_id ' .
745 'WHERE typ_id = ' . $this->db->quote($a_typ_id,
'integer') .
' ' .
748 $res = $this->db->query($query);
750 while ($row = $this->db->fetchObject(
$res)) {
751 $ops_id[] = (
int) $row->ops_id;
761 $query =
"SELECT * FROM object_data WHERE type = 'typ' AND title = " . $this->db->quote($a_type,
'text') .
" ";
762 $res = $this->db->query($query);
774 if ($a_class !=
'create') {
775 $condition =
"AND class != " . $this->db->quote(
'create',
'text');
777 $condition =
"AND class = " . $this->db->quote(
'create',
'text');
780 $query =
"SELECT ro.ops_id FROM rbac_operations ro " .
781 "JOIN rbac_ta rt ON ro.ops_id = rt.ops_id " .
782 "JOIN object_data od ON rt.typ_id = od.obj_id " .
783 "WHERE type = " . $this->db->quote(
'typ',
'text') .
" " .
784 "AND title = " . $this->db->quote($a_type,
'text') .
" " .
786 "ORDER BY op_order ";
788 $res = $this->db->query($query);
791 $ops[] = (
int) $row->ops_id;
802 $query =
'SELECT parent p FROM rbac_fa ' .
803 'WHERE assign = ' . $this->db->quote(
'n',
'text') .
' ' .
804 'AND rol_id = ' . $this->db->quote($a_rol_id,
'integer') .
' ';
806 if ($a_filter !== []) {
807 $query .= (
'AND ' . $this->db->in(
'parent', (array) $a_filter,
false,
'integer'));
810 $res = $this->db->query($query);
813 $parent[] = (
int) $row->p;
825 $r = $this->db->query(
$q);
830 '%s::isDeleted(): Role folder with ref_id %s not found!',
837 return $row->tree < 0;
855 case self::FILTER_ALL:
858 case self::FILTER_ALL_GLOBAL:
859 $where =
'WHERE ' . $this->db->in(
'rbac_fa.rol_id', $this->
getGlobalRoles(),
false,
'integer') .
' ';
862 case self::FILTER_ALL_LOCAL:
863 case self::FILTER_INTERNAL:
864 case self::FILTER_NOT_INTERNAL:
865 $where =
'WHERE ' . $this->db->in(
'rbac_fa.rol_id', $this->
getGlobalRoles(),
true,
'integer');
868 case self::FILTER_TEMPLATES:
869 $where =
"WHERE object_data.type = 'rolt'";
879 $where =
'WHERE ' . $this->db->in(
888 $query =
"SELECT * FROM object_data " .
889 "JOIN rbac_fa ON obj_id = rol_id " .
891 "AND rbac_fa.assign = " . $this->db->quote($assign,
'text') .
" ";
893 if (strlen($title_filter)) {
894 $query .= (
' AND ' . $this->db->like(
897 '%' . $title_filter .
'%' 901 $res = $this->db->query($query);
902 while ($row = $this->db->fetchAssoc(
$res)) {
903 $row[
'title'] = $row[
'title'] ??
'';
904 $prefix = substr($row[
'title'], 0, 3) ==
"il_";
907 if ($a_filter == 4 && !$prefix) {
912 if ($a_filter == 5 && $prefix) {
916 $row[
'description'] = $row[
'description'] ??
'';
917 $row[
"desc"] = $row[
"description"];
918 $row[
"user_id"] = (
int) $row[
"owner"];
919 $row[
'obj_id'] = (
int) $row[
'obj_id'];
920 $row[
'rol_id'] = (
int) $row[
'rol_id'];
921 $row[
'parent'] = (
int) $row[
'parent'];
929 $q =
"SELECT obj_id FROM object_data " .
930 "WHERE title=" . $this->db->quote($a_type,
'text') .
" AND type='typ'";
931 $r = $this->db->query(
$q);
933 return (
int) $row->obj_id;
946 $ilDB = $DIC->database();
947 if ($operations === []) {
951 $query =
'SELECT ops_id FROM rbac_operations ' .
952 'WHERE ' .
$ilDB->in(
'operation', $operations,
false,
'text');
956 while ($row =
$ilDB->fetchObject(
$res)) {
957 $ops_ids[] = (
int) $row->ops_id;
969 $ilDB = $DIC->database();
972 if (!is_array(self::$_opsCache)) {
973 self::$_opsCache = [];
975 $q =
"SELECT ops_id, operation FROM rbac_operations";
978 self::$_opsCache[$row->operation] = (
int) $row->ops_id;
983 if (array_key_exists($a_operation, self::$_opsCache)) {
984 return self::$_opsCache[$a_operation];
998 $ilDB = $DIC->database();
1001 foreach ($a_type_arr as $type) {
1002 $operations[] = (
'create_' . $type);
1005 if ($operations === []) {
1009 $query =
'SELECT ops_id, operation FROM rbac_operations ' .
1010 'WHERE ' .
$ilDB->in(
'operation', $operations,
false,
'text');
1015 while ($row =
$ilDB->fetchObject(
$res)) {
1016 $type_arr = explode(
'_', $row->operation);
1017 $type = $type_arr[1];
1019 $ops_ids[$type] = (
int) $row->ops_id;
1029 $query =
'SELECT protected FROM rbac_fa ' .
1031 $res = $this->db->query($query);
1033 if ($row->protected ===
'y') {
1042 $query =
'SELECT blocked from rbac_fa ' .
1043 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1044 'AND parent = ' . $this->db->quote($a_ref_id,
'integer');
1045 $res = $this->db->query($query);
1047 return (
bool) $row->blocked;
1060 $tree = $DIC[
'tree'];
1065 $query =
'SELECT parent from rbac_fa ' .
1066 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1067 'AND blocked = ' . $this->db->quote(1,
'integer');
1068 $res = $this->db->query($query);
1072 $parent_ids[] = (
int) $row->parent;
1075 foreach ($parent_ids as $parent_id) {
1076 if ($tree->isGrandChild($parent_id, $a_ref_id)) {
1089 $rbacsystem = $DIC->rbac()->system();
1090 $ilUser = $DIC->user();
1094 $leveladmin =
false;
1096 foreach ($a_role_hierarchy as $role_id => $rolf_id) {
1097 if ($leveladmin ==
true) {
1098 $a_parent_roles[$role_id][
'protected'] =
false;
1102 if ($a_parent_roles[$role_id][
'protected'] ==
true) {
1103 $arr_lvl_roles_user = array_intersect(
1105 array_keys($a_role_hierarchy, $rolf_id)
1108 foreach ($arr_lvl_roles_user as $lvl_role_id) {
1110 $rolf = $a_parent_roles[$role_id][
'parent'];
1111 if ($rbacsystem->checkPermission($rolf, $lvl_role_id,
'edit_permission')) {
1112 $a_parent_roles[$role_id][
'protected'] =
false;
1117 return $a_parent_roles;
1127 $ilDB = $DIC->database();
1131 'SELECT * FROM rbac_operations ' .
1132 'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id ' .
1133 'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id ' .
1134 'WHERE object_data.title = %s ' .
1135 'AND object_data.type = %s ' .
1136 'ORDER BY op_order ASC',
1137 $ilDB->quote($a_type,
'text'),
1138 $ilDB->quote(
'typ',
'text')
1141 $query =
'SELECT * FROM rbac_operations ORDER BY op_order ASC';
1144 while ($row =
$ilDB->fetchAssoc(
$res)) {
1146 "ops_id" => (
int) $row[
'ops_id'],
1147 "operation" => $row[
'operation'],
1148 "desc" => $row[
'description'],
1149 "class" => $row[
'class'],
1150 "order" => (
int) $row[
'op_order']
1159 foreach ($a_ops_arr as $ops) {
1160 $arr[$ops[
'class']][] = [
'ops_id' => (
int) $ops[
'ops_id'],
1161 'name' => $ops[
'operation']
1174 static $obj_cache = [];
1176 if (isset($obj_cache[$a_role_id]) && $obj_cache[$a_role_id]) {
1177 return $obj_cache[$a_role_id];
1180 $query =
'SELECT obr.obj_id FROM rbac_fa rfa ' .
1181 'JOIN object_reference obr ON rfa.parent = obr.ref_id ' .
1182 'WHERE assign = ' . $this->db->quote(
'y',
'text') .
' ' .
1183 'AND rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1184 'AND deleted IS NULL';
1186 $res = $this->db->query($query);
1187 $obj_cache[$a_role_id] = 0;
1188 while ($row = $this->db->fetchObject(
$res)) {
1189 $obj_cache[$a_role_id] = (
int) $row->obj_id;
1191 return $obj_cache[$a_role_id];
1196 $query =
'SELECT parent p_ref FROM rbac_fa ' .
1197 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1198 'AND assign = ' . $this->db->quote(
'y',
'text');
1200 $res = $this->db->query($query);
1202 return (
int) $row->p_ref;
1214 if ($rolf_list !== []) {
1215 foreach ($rolf_list as $rolf) {
1229 $query =
"SELECT * FROM object_data " .
1230 "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id " .
1232 "AND rbac_fa.assign = 'y' " .
1233 'AND ' . $this->db->in(
'object_data.obj_id', $role_ids,
false,
'integer');
1235 $res = $this->db->query($query);
1237 while ($row = $this->db->fetchAssoc(
$res)) {
1238 $row[
"desc"] = $row[
"description"];
1239 $row[
"user_id"] = (
int) $row[
"owner"];
1240 $role_list[] = $row;
1253 $this->db = $DIC[
'ilDB'];
1255 $query =
'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta ' .
1256 'JOIN object_data obj ON obj.obj_id = ta.typ_id ' .
1257 'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1258 $res = $this->db->query($query);
1262 while ($row = $this->db->fetchObject(
$res)) {
1263 $info[$counter][
'typ_id'] = (
int) $row->typ_id;
1264 $info[$counter][
'type'] = $row->title;
1265 $info[$counter][
'ops_id'] = (
int) $row->ops_id;
1266 $info[$counter][
'operation'] = $row->operation;
1295 return substr($title, 0, 3) ==
'il_';
1298 public function getParentOfRole(
int $role_id, ?
int $object_ref = null): ?
int 1302 $tree = $DIC[
'tree'];
1309 $path_ids = $tree->getPathId($object_ref);
1312 while (
$ref_id = array_pop($path_ids)) {
1314 foreach ($roles as $role) {
1315 if ((
int) $role[
'obj_id'] === $role_id) {
1328 $and = (
'AND assign = ' . $this->db->quote(
'y',
'text'));
1333 $query =
'SELECT * FROM rbac_fa ' .
1334 'WHERE rol_id = ' . $this->db->quote($a_role_id,
'integer') .
' ' .
1336 $res = $this->db->query($query);
1338 return (
int) $row->parent;
1348 $query =
"SELECT ops_id FROM rbac_pa JOIN rbac_ua " .
1349 "ON (rbac_pa.rol_id = rbac_ua.rol_id) " .
1350 "WHERE rbac_ua.usr_id = " . $this->db->quote($a_user_id,
'integer') .
" " .
1351 "AND rbac_pa.ref_id = " . $this->db->quote($a_ref_id,
'integer') .
" ";
1353 $res = $this->db->query($query);
1355 while ($row = $this->db->fetchObject(
$res)) {
1356 $ops = unserialize($row->ops_id);
1357 $all_ops = array_merge($all_ops, $ops);
1359 $all_ops = array_unique($all_ops);
1361 $set = $this->db->query(
"SELECT operation FROM rbac_operations " .
1362 " WHERE " . $this->db->in(
"ops_id", $all_ops,
false,
"integer"));
1364 while ($rec = $this->db->fetchAssoc($set)) {
1365 $perms[] = $rec[
"operation"];
1375 self::$is_assigned_cache[$a_role_id][$a_user_id] = $a_value;
1380 return self::$is_assigned_cache[$a_role_id][$a_user_id];
1388 self::$is_assigned_cache = [];
1389 self::$assigned_users_cache = [];
1396 $ilDB = $DIC->database();
1400 "SELECT ops_id" . PHP_EOL
1401 .
"FROM rbac_operations" . PHP_EOL
1402 .
"WHERE operation = " .
$ilDB->quote($operation,
"text") . PHP_EOL
1411 return (
int) $row[
"ops_id"] ?? null;
1418 $ilDB = $DIC->database();
1422 "SELECT typ_id" . PHP_EOL
1423 .
"FROM rbac_ta" . PHP_EOL
1424 .
"WHERE typ_id = " .
$ilDB->quote($type_id,
"integer") . PHP_EOL
1425 .
"AND ops_id = " .
$ilDB->quote($ops_id,
"integer") . PHP_EOL
1428 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
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.
__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)
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)
static _getCustomRBACOperationId(string $operation, \ilDBInterface $ilDB=null)
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)
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...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
assignedGlobalRoles(int $a_usr_id)
Get assigned global roles for an user.
getActiveOperationsOfRole(int $a_ref_id, int $a_role_id)
Get active operations for a role.
isRoleDeleted(int $a_role_id)
return if role is only attached to deleted role folders
static _isRBACOperation(int $type_id, int $ops_id, \ilDBInterface $ilDB=null)
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.