57 (isset($ilDB)) ? $this->
ilDB =&$ilDB : $this->
ilDB =&$ilias->db;
79 if (empty($a_title)) {
80 $message = get_class($this) .
"::roleExists(): No title given!";
81 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
84 $clause = ($a_id) ?
" AND obj_id != " . $ilDB->quote($a_id) .
" " :
"";
86 $q =
"SELECT DISTINCT(obj_id) obj_id FROM object_data " .
87 "WHERE title =" . $ilDB->quote($a_title) .
" " .
88 "AND type IN('role','rolt')" .
113 if (!isset($a_path) or !is_array($a_path)) {
114 $message = get_class($this) .
"::getParentRoles(): No path given or wrong datatype!";
115 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
118 $parent_roles =
array();
119 $role_hierarchy =
array();
121 foreach ($a_path as $ref_id) {
123 foreach ($roles as $role) {
124 $id = $role[
"obj_id"];
125 $role[
"parent"] = $ref_id;
126 $parent_roles[
$id] = $role;
128 if (!array_key_exists($role[
'obj_id'], $role_hierarchy)) {
129 $role_hierarchy[
$id] = $ref_id;
149 if (!isset($a_endnode_id)) {
151 $message = get_class($this) .
"::getParentRoleIds(): No node_id (ref_id) given!";
152 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
157 $pathIds = $tree->getPathId($a_endnode_id);
161 $pathIds[0] = ROLE_FOLDER_ID;
163 #return $this->getParentRoles($a_endnode_id,$a_templates,$a_keep_protected); 179 if (!isset($a_ref_id) or !isset($a_templates)) {
180 $message = get_class($this) .
"::getRoleListByObject(): Missing parameter!" .
181 "ref_id: " . $a_ref_id .
182 "tpl_flag: " . $a_templates;
183 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
186 $role_list =
array();
190 $query =
"SELECT * FROM object_data " .
191 "JOIN rbac_fa ON obj_id = rol_id " .
193 "AND object_data.obj_id = rbac_fa.rol_id " .
194 "AND rbac_fa.parent = " . $ilDB->quote($a_ref_id,
'integer') .
" ";
197 while (
$row = $ilDB->fetchAssoc(
$res)) {
215 public function getAssignableRoles($a_templates =
false, $a_internal_roles =
false, $title_filter =
'')
219 $role_list =
array();
223 $query =
"SELECT * FROM object_data " .
224 "JOIN rbac_fa ON obj_id = rol_id " .
226 "AND rbac_fa.assign = 'y' ";
228 if (strlen($title_filter)) {
229 $query .= (
' AND ' . $ilDB->like(
237 while (
$row = $ilDB->fetchAssoc(
$res)) {
259 $query =
'SELECT rol_id FROM rbac_fa fa ' .
260 'JOIN tree t1 ON t1.child = fa.parent ' .
261 'JOIN object_data obd ON fa.rol_id = obd.obj_id ' .
262 'WHERE assign = ' . $ilDB->quote(
'y',
'text') .
' ' .
263 'AND obd.type = ' . $ilDB->quote(
'role',
'text') .
' ' .
264 'AND t1.child IN (' .
265 $GLOBALS[
'tree']->getSubTreeQuery($ref_id,
array(
'child')) .
' ' .
271 $role_list =
array();
273 $role_list[] =
$row->rol_id;
289 $query =
"SELECT fa.*, rd.* " .
290 "FROM object_data rd " .
291 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id " .
292 "WHERE fa.assign = 'y' " .
293 "AND fa.parent = " . $this->
ilDB->
quote($a_ref_id,
'integer') .
" " 297 while (
$row = $ilDB->fetchAssoc(
$res)) {
298 $roles_data[] =
$row;
300 return $roles_data ? $roles_data :
array();
314 if ($a_templates ===
true) {
315 $where =
"WHERE " . $ilDB->in(
'object_data.type',
array(
'role',
'rolt'),
false,
'text') .
" ";
317 $where =
"WHERE " . $ilDB->in(
'object_data.type',
array(
'role'),
false,
'text') .
" ";
337 foreach ($a_role_list as
$key => $val) {
339 if ($val[
"type"] ==
"rolt") {
340 $a_role_list[
$key][
"role_type"] =
"template";
342 if ($val[
"assign"] ==
"y") {
343 if ($val[
"parent"] == ROLE_FOLDER_ID) {
344 $a_role_list[
$key][
"role_type"] =
"global";
346 $a_role_list[
$key][
"role_type"] =
"local";
349 $a_role_list[
$key][
"role_type"] =
"linked";
353 if ($val[
"protected"] ==
"y") {
354 $a_role_list[
$key][
"protected"] =
true;
356 $a_role_list[
$key][
"protected"] =
false;
374 $query =
'SELECT COUNT(DISTINCT(usr_id)) as num FROM rbac_ua ' .
375 'WHERE ' . $ilDB->in(
'rol_id', $a_roles,
false,
'integer') .
' ';
393 if (!isset($a_rol_id)) {
394 $message = get_class($this) .
"::assignedUsers(): No role_id given!";
395 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
397 if (isset(self::$assigned_users_cache[$a_rol_id])) {
398 return self::$assigned_users_cache[$a_rol_id];
401 $result_arr =
array();
403 $query =
"SELECT usr_id FROM rbac_ua WHERE rol_id= " . $ilDB->quote($a_rol_id,
'integer');
405 while (
$row = $ilDB->fetchAssoc(
$res)) {
406 array_push($result_arr,
$row[
"usr_id"]);
409 self::$assigned_users_cache[$a_rol_id] = $result_arr;
425 if (isset(self::$is_assigned_cache[$a_role_id][$a_usr_id])) {
426 return self::$is_assigned_cache[$a_role_id][$a_usr_id];
431 $ilDB->setLimit(1, 0);
432 $query =
"SELECT usr_id FROM rbac_ua WHERE " .
433 "rol_id= " . $ilDB->quote($a_role_id,
'integer') .
" " .
434 "AND usr_id= " . $ilDB->quote($a_usr_id);
437 $is_assigned =
$res->numRows() == 1;
438 self::$is_assigned_cache[$a_role_id][$a_usr_id] = $is_assigned;
459 $ilDB->setLimit(1, 0);
460 $query =
"SELECT usr_id FROM rbac_ua WHERE " .
461 $ilDB->in(
'rol_id', $a_role_ids,
false,
'integer') .
462 " AND usr_id= " . $ilDB->quote($a_usr_id);
465 return $ilDB->numRows(
$res) == 1;
481 $query =
"SELECT rol_id FROM rbac_ua WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer');
484 while (
$row = $ilDB->fetchObject(
$res)) {
485 $role_arr[] =
$row->rol_id;
487 return $role_arr ? $role_arr :
array();
499 $query =
"SELECT ua.rol_id FROM rbac_ua ua " .
500 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
501 "WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer') .
' ' .
502 "AND parent = " . $ilDB->quote(ROLE_FOLDER_ID) .
" " .
506 while (
$row = $ilDB->fetchObject(
$res)) {
507 $role_arr[] =
$row->rol_id;
509 return $role_arr ? $role_arr :
array();
524 $ilBench->start(
"RBAC",
"review_isAssignable");
527 if ($a_rol_id == SYSTEM_ROLE_ID) {
528 $ilBench->stop(
"RBAC",
"review_isAssignable");
532 if (!isset($a_rol_id) or !isset($a_ref_id)) {
533 $message = get_class($this) .
"::isAssignable(): Missing parameter!" .
534 " role_id: " . $a_rol_id .
" ,ref_id: " . $a_ref_id;
535 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
537 $query =
"SELECT * FROM rbac_fa " .
538 "WHERE rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" " .
539 "AND parent = " . $ilDB->quote($a_ref_id,
'integer') .
" ";
543 $ilBench->stop(
"RBAC",
"review_isAssignable");
544 return $row->assign ==
'y' ? true :
false;
556 $query =
"SELECT * FROM rbac_fa WHERE rol_id = " . $ilDB->quote($a_role_id,
'integer') .
' ' .
557 "AND assign = " . $ilDB->quote(
'y',
'text');
559 return $res->numRows() > 1;
577 if (!isset($a_rol_id)) {
578 $message = get_class($this) .
"::getFoldersAssignedToRole(): No role_id given!";
579 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
583 $where =
" AND assign ='y'";
586 $query =
"SELECT DISTINCT parent FROM rbac_fa " .
587 "WHERE rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" " . $where .
" ";
590 while (
$row = $ilDB->fetchObject(
$res)) {
591 $folders[] =
$row->parent;
593 return $folders ? $folders :
array();
607 if (!isset($a_ref_id)) {
611 if ($a_assignable_only ===
true) {
612 $and =
'AND assign = ' . $ilDB->quote(
'y',
'text');
614 $query =
"SELECT rol_id FROM rbac_fa " .
615 "WHERE parent = " . $ilDB->quote($a_ref_id,
'integer') .
" " .
621 while (
$row = $ilDB->fetchObject(
$res)) {
622 $role_ids[] =
$row->rol_id;
644 $ilBench->start(
"RBAC",
"review_getRolesOfRoleFolder");
646 if (!isset($a_ref_id)) {
647 $message = get_class($this) .
"::getRolesOfRoleFolder(): No ref_id given!";
649 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
652 if ($a_nonassignable ===
false) {
653 $and =
" AND assign='y'";
656 $query =
"SELECT rol_id FROM rbac_fa " .
657 "WHERE parent = " . $ilDB->quote($a_ref_id,
'integer') .
" " .
661 while (
$row = $ilDB->fetchObject(
$res)) {
662 $rol_id[] =
$row->rol_id;
665 $ilBench->stop(
"RBAC",
"review_getRolesOfRoleFolder");
667 return $rol_id ? $rol_id :
array();
693 $lroles[] = $role_id;
708 $lroles[] = $role_id;
722 $ga[] =
array(
'obj_id' => $role_id,
723 'role_type' =>
'global');
725 return $ga ? $ga :
array();
736 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
740 $ga[] =
array(
'obj_id' => $role_id,
741 'role_type' =>
'global');
744 return $ga ? $ga :
array();
754 global $rbacreview,
$ilDB;
756 $query =
'SELECT * FROM rbac_fa ' .
757 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
758 'AND parent = ' . $ilDB->quote($a_parent_id,
'integer');
760 return $res->numRows() ? true :
false;
773 $query =
'SELECT * FROM rbac_operations ORDER BY ops_id ';
775 while (
$row = $ilDB->fetchObject(
$res)) {
777 'operation' =>
$row->operation,
778 'description' =>
$row->description);
781 return $ops ? $ops :
array();
794 $query =
'SELECT * FROM rbac_operations WHERE ops_id = ' . $ilDB->quote($ops_id,
'integer');
796 while (
$row = $ilDB->fetchObject(
$res)) {
798 'operation' =>
$row->operation,
799 'description' =>
$row->description);
802 return $ops ? $ops :
array();
819 $a_parent = ROLE_FOLDER_ID;
822 $query =
"SELECT ops_id,type FROM rbac_templates " .
823 "WHERE rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" " .
824 "AND parent = " . $ilDB->quote($a_parent,
'integer');
828 while (
$row = $ilDB->fetchObject(
$res)) {
829 $ops_arr[
$row->type][] =
$row->ops_id;
831 return (
array) $ops_arr;
845 $query =
'SELECT * FROM rbac_pa ' .
846 'WHERE ref_id = ' . $ilDB->quote($a_ref_id,
'integer') .
' ' .
847 'AND rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ';
851 return unserialize(
$row[
'ops_id']);
871 if (!isset($a_rol_id) or !isset(
$a_type)) {
872 $message = get_class($this) .
"::getOperationsOfRole(): Missing Parameter!" .
873 "role_id: " . $a_rol_id .
875 "parent_id: " . $a_parent;
876 $ilLog->logStack(
"Missing parameter! ");
877 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
883 if ($a_parent == 0) {
884 $a_parent = ROLE_FOLDER_ID;
887 $query =
"SELECT ops_id FROM rbac_templates " .
888 "WHERE type =" . $ilDB->quote(
$a_type,
'text') .
" " .
889 "AND rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" " .
890 "AND parent = " . $ilDB->quote($a_parent,
'integer');
892 while (
$row = $ilDB->fetchObject(
$res)) {
893 $ops_arr[] =
$row->ops_id;
910 $query =
"SELECT * FROM rbac_pa " .
911 "WHERE rol_id = " . $ilDB->quote($a_role_id,
'integer') .
" " .
912 "AND ref_id = " . $ilDB->quote($a_ref_id,
'integer') .
" ";
915 while (
$row = $ilDB->fetchObject(
$res)) {
916 $ops = unserialize(
$row->ops_id);
919 return $ops ? $ops :
array();
933 if (!isset($a_typ_id)) {
934 $message = get_class($this) .
"::getOperationsOnType(): No type_id given!";
935 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
938 #$query = "SELECT * FROM rbac_ta WHERE typ_id = ".$ilDB->quote($a_typ_id,'integer'); 940 $query =
'SELECT * FROM rbac_ta ta JOIN rbac_operations o ON ta.ops_id = o.ops_id ' .
941 'WHERE typ_id = ' . $ilDB->quote($a_typ_id,
'integer') .
' ' .
946 while (
$row = $ilDB->fetchObject(
$res)) {
947 $ops_id[] =
$row->ops_id;
950 return $ops_id ? $ops_id :
array();
965 $query =
"SELECT * FROM object_data WHERE type = 'typ' AND title = " . $ilDB->quote(
$a_type,
'text') .
" ";
986 if ($a_class !=
'create') {
987 $condition =
"AND class != " . $ilDB->quote(
'create',
'text');
989 $condition =
"AND class = " . $ilDB->quote(
'create',
'text');
992 $query =
"SELECT ro.ops_id FROM rbac_operations ro " .
993 "JOIN rbac_ta rt ON ro.ops_id = rt.ops_id " .
994 "JOIN object_data od ON rt.typ_id = od.obj_id " .
995 "WHERE type = " . $ilDB->quote(
'typ',
'text') .
" " .
996 "AND title = " . $ilDB->quote(
$a_type,
'text') .
" " .
998 "ORDER BY op_order ";
1004 $ops[] =
$row->ops_id;
1023 #$query = 'SELECT t.parent p FROM tree t JOIN rbac_fa fa ON fa.parent = child '. 1024 # 'WHERE assign = '.$ilDB->quote('n','text').' '. 1025 # 'AND rol_id = '.$ilDB->quote($a_rol_id,'integer').' '; 1027 $query =
'SELECT parent p FROM rbac_fa ' .
1028 'WHERE assign = ' . $ilDB->quote(
'n',
'text') .
' ' .
1029 'AND rol_id = ' . $ilDB->quote($a_rol_id,
'integer') .
' ';
1032 $query .= (
'AND ' . $ilDB->in(
'parent', (
array) $a_filter,
false,
'integer'));
1038 $parent[] =
$row->p;
1054 $q =
"SELECT tree FROM tree WHERE child =" . $ilDB->quote($a_node_id) .
" ";
1061 '%s::isDeleted(): Role folder with ref_id %s not found!',
1065 $this->log->write(
$message, $this->log->FATAL);
1071 if (
$row->tree < 0) {
1104 switch ($a_filter) {
1106 case self::FILTER_ALL:
1111 case self::FILTER_ALL_GLOBAL:
1112 $where =
'WHERE ' . $ilDB->in(
'rbac_fa.rol_id', $this->
getGlobalRoles(),
false,
'integer') .
' ';
1116 case self::FILTER_ALL_LOCAL:
1117 case self::FILTER_INTERNAL:
1118 case self::FILTER_NOT_INTERNAL:
1119 $where =
'WHERE ' . $ilDB->in(
'rbac_fa.rol_id', $this->
getGlobalRoles(),
true,
'integer');
1123 case self::FILTER_TEMPLATES:
1124 $where =
"WHERE object_data.type = 'rolt'";
1135 $where =
'WHERE ' . $ilDB->in(
'rbac_fa.rol_id', $this->
assignedRoles($a_user_id),
false,
'integer') .
' ';
1141 $query =
"SELECT * FROM object_data " .
1142 "JOIN rbac_fa ON obj_id = rol_id " .
1144 "AND rbac_fa.assign = " . $ilDB->quote($assign,
'text') .
" ";
1146 if (strlen($title_filter)) {
1147 $query .= (
' AND ' . $ilDB->like(
1150 '%' . $title_filter .
'%' 1155 while (
$row = $ilDB->fetchAssoc(
$res)) {
1156 $prefix = (substr(
$row[
"title"], 0, 3) ==
"il_") ?
true :
false;
1159 if ($a_filter == 4 and !$prefix) {
1164 if ($a_filter == 5 and $prefix) {
1168 $row[
"desc"] =
$row[
"description"];
1175 return $roles ? $roles :
array();
1189 $q =
"SELECT obj_id FROM object_data " .
1190 "WHERE title=" . $ilDB->quote(
$a_type,
'text') .
" AND type='typ'";
1191 $r = $ilDB->query($q);
1194 return $row->obj_id;
1211 if (!count($operations)) {
1215 $query =
'SELECT ops_id FROM rbac_operations ' .
1216 'WHERE ' . $ilDB->in(
'operation', $operations,
false,
'text');
1219 while (
$row = $ilDB->fetchObject(
$res)) {
1220 $ops_ids[] =
$row->ops_id;
1222 return $ops_ids ? $ops_ids :
array();
1237 if (!isset($a_operation)) {
1238 $message =
"perm::getOperationId(): No operation given!";
1239 $ilErr->raiseError(
$message, $ilErr->WARNING);
1243 if (!is_array(self::$_opsCache)) {
1244 self::$_opsCache =
array();
1246 $q =
"SELECT ops_id, operation FROM rbac_operations";
1247 $r = $ilDB->query($q);
1249 self::$_opsCache[
$row->operation] =
$row->ops_id;
1254 if (array_key_exists($a_operation, self::$_opsCache)) {
1255 return self::$_opsCache[$a_operation];
1270 $operations =
array();
1271 foreach ($a_type_arr as
$type) {
1272 $operations[] = (
'create_' .
$type);
1275 if (!count($operations)) {
1279 $query =
'SELECT ops_id, operation FROM rbac_operations ' .
1280 'WHERE ' . $ilDB->in(
'operation', $operations,
false,
'text');
1285 while (
$row = $ilDB->fetchObject(
$res)) {
1286 $type_arr = explode(
'_',
$row->operation);
1287 $type = $type_arr[1];
1309 $query =
"SELECT protected FROM rbac_fa " .
1310 "WHERE rol_id = " . $ilDB->quote($a_role_id,
'integer') .
" ";
1328 $query =
'SELECT blocked from rbac_fa ' .
1329 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
1330 'AND parent = ' . $ilDB->quote($a_ref_id,
'integer');
1333 return (
bool)
$row->blocked;
1345 global
$ilDB, $tree;
1350 $query =
'SELECT parent from rbac_fa ' .
1351 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
1352 'AND blocked = ' . $ilDB->quote(1,
'integer');
1355 $parent_ids =
array();
1357 $parent_ids[] =
$row->parent;
1360 foreach ($parent_ids as $parent_id) {
1361 if ($tree->isGrandChild($parent_id, $a_ref_id)) {
1388 if (in_array(SYSTEM_ROLE_ID, $this->
assignedRoles($ilUser->getId()))) {
1391 $leveladmin =
false;
1393 #vd("RoleHierarchy",$a_role_hierarchy); 1394 foreach ($a_role_hierarchy as $role_id => $rolf_id) {
1396 #echo "<br/>ROLF: ".$rolf_id." ROLE_ID: ".$role_id." (".$a_parent_roles[$role_id]['title'].") "; 1399 if ($leveladmin ==
true) {
1400 $a_parent_roles[$role_id][
'protected'] =
false;
1404 if ($a_parent_roles[$role_id][
'protected'] ==
true) {
1405 $arr_lvl_roles_user = array_intersect($this->
assignedRoles($ilUser->getId()), array_keys($a_role_hierarchy, $rolf_id));
1407 #vd("intersection",$arr_lvl_roles_user); 1409 foreach ($arr_lvl_roles_user as $lvl_role_id) {
1410 #echo "<br/>level_role: ".$lvl_role_id; 1411 #echo "<br/>a_ref_id: ".$a_ref_id; 1415 $rolf = $a_parent_roles[$role_id][
'parent'];
1416 #$parent_obj = $GLOBALS['tree']->getParentId($rolf); 1417 if ($rbacsystem->checkPermission($rolf, $lvl_role_id,
'edit_permission')) {
1418 #echo "<br />Permission granted"; 1421 $a_parent_roles[$role_id][
'protected'] =
false;
1429 return $a_parent_roles;
1450 'SELECT * FROM rbac_operations ' .
1451 'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id ' .
1452 'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id ' .
1453 'WHERE object_data.title = %s ' .
1454 'AND object_data.type = %s ' .
1455 'ORDER BY op_order ASC',
1456 $ilDB->quote(
$a_type,
'text'),
1457 $ilDB->quote(
'typ',
'text')
1460 $query =
'SELECT * FROM rbac_operations ORDER BY op_order ASC';
1463 while (
$row = $ilDB->fetchAssoc(
$res)) {
1465 "ops_id" =>
$row[
'ops_id'],
1466 "operation" =>
$row[
'operation'],
1467 "desc" =>
$row[
'description'],
1468 "class" =>
$row[
'class'],
1469 "order" =>
$row[
'op_order']
1485 foreach ($a_ops_arr as $ops) {
1486 $arr[$ops[
'class']][] =
array(
'ops_id' => $ops[
'ops_id'],
1487 'name' => $ops[
'operation']
1505 static $obj_cache =
array();
1510 if (isset($obj_cache[$a_role_id]) and $obj_cache[$a_role_id]) {
1511 return $obj_cache[$a_role_id];
1514 $query =
'SELECT obr.obj_id FROM rbac_fa rfa ' .
1515 'JOIN object_reference obr ON rfa.parent = obr.ref_id ' .
1516 'WHERE assign = ' . $ilDB->quote(
'y',
'text') .
' ' .
1517 'AND rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
1518 'AND deleted IS NULL';
1520 #$query = "SELECT obr.obj_id FROM rbac_fa rfa ". 1521 # "JOIN tree ON rfa.parent = tree.child ". 1522 # "JOIN object_reference obr ON tree.parent = obr.ref_id ". 1523 # "WHERE tree.tree = 1 ". 1524 # "AND assign = 'y' ". 1525 # "AND rol_id = ".$ilDB->quote($a_role_id,'integer')." "; 1528 $obj_cache[$a_role_id] = 0;
1529 while (
$row = $ilDB->fetchObject(
$res)) {
1530 $obj_cache[$a_role_id] =
$row->obj_id;
1532 return $obj_cache[$a_role_id];
1545 $query =
'SELECT parent p_ref FROM rbac_fa ' .
1546 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
1547 'AND assign = ' . $ilDB->quote(
'y',
'text');
1567 if (count($rolf_list)) {
1568 foreach ($rolf_list as $rolf) {
1591 $role_list =
array();
1595 $query =
"SELECT * FROM object_data " .
1596 "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id " .
1598 "AND rbac_fa.assign = 'y' " .
1599 'AND ' . $ilDB->in(
'object_data.obj_id', $role_ids,
false,
'integer');
1602 while (
$row = $ilDB->fetchAssoc(
$res)) {
1603 $row[
"desc"] =
$row[
"description"];
1605 $role_list[] =
$row;
1621 $query =
'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta ' .
1622 'JOIN object_data obj ON obj.obj_id = ta.typ_id ' .
1623 'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1627 while (
$row = $ilDB->fetchObject(
$res)) {
1649 if ($a_role_id == SYSTEM_ROLE_ID or $a_role_id == ANONYMOUS_ROLE_ID) {
1667 return substr(
$title, 0, 3) ==
'il_' ? true :
false;
1683 $and = (
'AND assign = ' . $ilDB->quote(
'y',
'text'));
1688 $query =
'SELECT * FROM rbac_fa ' .
1689 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
1693 return $row->parent;
1709 $query =
"SELECT ops_id FROM rbac_pa JOIN rbac_ua " .
1710 "ON (rbac_pa.rol_id = rbac_ua.rol_id) " .
1711 "WHERE rbac_ua.usr_id = " . $ilDB->quote($a_user_id,
'integer') .
" " .
1712 "AND rbac_pa.ref_id = " . $ilDB->quote($a_ref_id,
'integer') .
" ";
1716 while (
$row = $ilDB->fetchObject(
$res)) {
1717 $ops = unserialize(
$row->ops_id);
1718 $all_ops = array_merge($all_ops, $ops);
1720 $all_ops = array_unique($all_ops);
1722 $set = $ilDB->query(
"SELECT operation FROM rbac_operations " .
1723 " WHERE " . $ilDB->in(
"ops_id", $all_ops,
false,
"integer"));
1725 while ($rec = $ilDB->fetchAssoc($set)) {
1726 $perms[] = $rec[
"operation"];
1740 self::$is_assigned_cache[$a_role_id][$a_user_id] = $a_value;
1751 return self::$is_assigned_cache[$a_role_id][$a_user_id];
1759 self::$is_assigned_cache =
array();
1760 self::$assigned_users_cache =
array();
clearCaches()
Clear assigned users caches.
roleExists($a_title, $a_id=0)
Checks if a role already exists.
getLocalPolicies($a_ref_id)
Get all roles with local policies.
getObjectReferenceOfRole($a_role_id)
Get reference of role.
isDeleteable($a_role_id, $a_rolf_id)
Check if role is deleteable at a specific position.
static $assigned_users_cache
isDeleted($a_node_id)
Checks if a rolefolder is set as deleted (negative tree_id) public.
const PEAR_ERROR_CALLBACK
getOperationsOfRole($a_rol_id, $a_type, $a_parent=0)
get all possible operations of a specific role The ref_id of the role folder (parent object) is neces...
static _getOperationIdsByName($operations)
get ops_id's by name.
query($sql, $a_handle_error=true)
Query.
getRolesByFilter($a_filter=0, $a_user_id=0, $title_filter='')
ilDB $ilDB
getRoleListByObject($a_ref_id, $a_templates=false)
Returns a list of roles in an container public.
getRolesOfRoleFolder($a_ref_id, $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
assignedGlobalRoles($a_usr_id)
Get assigned global roles for an user.
getAssignableRoles($a_templates=false, $a_internal_roles=false, $title_filter='')
Returns a list of all assignable roles public.
getOperationsByTypeAndClass($a_type, $a_class)
Get operations by type and class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _getOperationList($a_type=null)
get operation list by object type public static
static _lookupTitle($a_id)
lookup object title
getOperationAssignment()
get operation assignments
const FILTER_NOT_INTERNAL
isBlockedInUpperContext($a_role_id, $a_ref_id)
Check if role is blocked in upper context.
isGlobalRole($a_role_id)
Check if role is a global role.
__setTemplateFilter($a_templates)
get roles and templates or only roles; returns string for where clause private
__setProtectedStatus($a_parent_roles, $a_role_hierarchy, $a_ref_id)
Set protected status type $rbacsystem type $ilUser type $log.
getRoleOperationsOnObject($a_role_id, $a_ref_id)
ilDB $ilDB
static $is_assigned_cache
static _getAssignUsersStatus($a_role_id)
getAssignableChildRoles($a_ref_id)
Get all assignable roles directly under a specific node public.
static lookupCreateOperationIds($a_type_arr)
Lookup operation ids.
__getParentRoles($a_path, $a_templates)
Note: This function performs faster than the new getParentRoles function, because it uses database in...
getActiveOperationsOfRole($a_ref_id, $a_role_id)
Get active operations for a role.
isProtected($a_ref_id, $a_role_id)
quote($a_query, $a_type=null)
Wrapper for quote method.
isAssignable($a_rol_id, $a_ref_id)
Check if its possible to assign users public.
getGlobalRolesArray()
get only 'global' roles public
isBlockedAtPosition($a_role_id, $a_ref_id)
Check if role is blocked at position ilDB $ilDB.
catch(Exception $e) $message
foreach($_POST as $key=> $value) $res
getAssignedCacheEntry($a_role_id, $a_user_id)
get entry of assigned_chache
getRolesForIDs($role_ids, $use_templates)
ilDB $ilDB
getOperation($ops_id)
get one operation by operation id public
setAssignedCacheEntry($a_role_id, $a_user_id, $a_value)
set entry of assigned_chache
isRoleAssignedToObject($a_role_id, $a_parent_id)
Check if role is assigned to an object.
getGlobalRoles()
get only 'global' roles public
getTypeId($a_type)
Get type id of object ilDB $ilDB.
isRoleDeleted($a_role_id)
return if role is only attached to deleted role folders
getNumberOfAssignedUsers(array $a_roles)
Get the number of assigned users to roles ilDB $ilDB.
getObjectOfRole($a_role_id)
Get object id of objects a role is assigned to.
isAssignedToAtLeastOneGivenRole($a_usr_id, $a_role_ids)
check if a specific user is assigned to at least one of the given role ids.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
getAllOperationsOfRole($a_rol_id, $a_parent=0)
get all possible operations of a specific role The ref_id of the role folder (parent object) is neces...
getParentRoleIds($a_endnode_id, $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...
hasMultipleAssignments($a_role_id)
Temporary bugfix.
getFoldersAssignedToRole($a_rol_id, $a_assignable=false)
Returns an array of objects assigned to a role.
static _getOperationIdByName($a_operation)
get operation id by name of operation public static
isAssigned($a_usr_id, $a_role_id)
check if a specific user is assigned to specific role public
getGlobalAssignableRoles()
get only 'global' roles (with flag 'assign_users') public
__construct()
Constructor public.
getOperations()
get all possible operations public
getRoleFolderOfRole($a_role_id)
Get role folder of role ilDB $ilDB.
assignedUsers($a_rol_id)
get all assigned users to a given role public
getOperationsOnTypeString($a_type)
all possible operations of a type public
assignedRoles($a_usr_id)
get all assigned roles to a given user public
getAssignableRolesInSubtree($ref_id)
Returns a list of assignable roles in a subtree of the repository public.
getUserPermissionsOnObject($a_user_id, $a_ref_id)
Get all user permissions on an object.
static getLogger($a_component_id)
Get component logger.
__setRoleType($a_role_list)
computes role type in role list array: global: roles in ROLE_FOLDER_ID local: assignable roles in oth...
static yn2tf($a_yn)
convert "y"/"n" to true/false
static _groupOperationsByClass($a_ops_arr)
isSystemGeneratedRole($a_role_id)
Check if the role is system generate role or role template.
getOperationsOnType($a_typ_id)
all possible operations of a type public
getRolesOfObject($a_ref_id, $a_assignable_only=false)
Get roles of object.
getLocalRoles($a_ref_id)
Get local roles of object.
getObjectsWithStopedInheritance($a_rol_id, $a_filter=array())
get all objects in which the inheritance of role with role_id was stopped the function returns all re...
class ilRbacReview Contains Review functions of core Rbac.