57 (isset($ilDB)) ? $this->
ilDB =& $ilDB : $this->
ilDB =& $ilias->db;
84 $message = get_class($this).
"::roleExists(): No title given!";
85 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
88 $clause = ($a_id) ?
" AND obj_id != ".$ilDB->quote($a_id).
" " :
"";
90 $q =
"SELECT DISTINCT(obj_id) obj_id FROM object_data ".
91 "WHERE title =".$ilDB->quote($a_title).
" ".
92 "AND type IN('role','rolt')".
118 if (!isset($a_path)
or !is_array($a_path))
120 $message = get_class($this).
"::getParentRoles(): No path given or wrong datatype!";
121 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
124 $parent_roles =
array();
125 $role_hierarchy =
array();
130 foreach($roles as $role)
132 $id = $role[
"obj_id"];
134 $parent_roles[$id] = $role;
136 if (!array_key_exists($role[
'obj_id'],$role_hierarchy))
138 $role_hierarchy[$id] =
$ref_id;
158 if (!isset($a_endnode_id))
161 $message = get_class($this).
"::getParentRoleIds(): No node_id (ref_id) given!";
162 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
167 $pathIds = $tree->getPathId($a_endnode_id);
171 $pathIds[0] = ROLE_FOLDER_ID;
173 #return $this->getParentRoles($a_endnode_id,$a_templates,$a_keep_protected); 189 if (!isset($a_ref_id)
or !isset($a_templates))
191 $message = get_class($this).
"::getRoleListByObject(): Missing parameter!".
192 "ref_id: ".$a_ref_id.
193 "tpl_flag: ".$a_templates;
194 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
197 $role_list =
array();
201 $query =
"SELECT * FROM object_data ".
202 "JOIN rbac_fa ON obj_id = rol_id ".
204 "AND object_data.obj_id = rbac_fa.rol_id ".
205 "AND rbac_fa.parent = ".$ilDB->quote($a_ref_id,
'integer').
" ";
208 while (
$row = $ilDB->fetchAssoc(
$res))
231 $role_list =
array();
235 $query =
"SELECT * FROM object_data ".
236 "JOIN rbac_fa ON obj_id = rol_id ".
238 "AND rbac_fa.assign = 'y' ";
240 if(strlen($title_filter))
242 $query .= (
' AND '.$ilDB->like(
250 while (
$row = $ilDB->fetchAssoc(
$res))
273 $query =
'SELECT rol_id FROM rbac_fa fa '.
274 'JOIN tree t1 ON t1.child = fa.parent '.
275 'JOIN object_data obd ON fa.rol_id = obd.obj_id ' .
276 'WHERE assign = '.$ilDB->quote(
'y',
'text').
' '.
277 'AND obd.type = '.$ilDB->quote(
'role',
'text').
' '.
285 $role_list =
array();
288 $role_list[] =
$row->rol_id;
304 $query =
"SELECT fa.*, rd.* ".
305 "FROM object_data rd ".
306 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id ".
307 "WHERE fa.assign = 'y' ".
308 "AND fa.parent = ".$this->ilDB->quote($a_ref_id,
'integer').
" " 312 while(
$row = $ilDB->fetchAssoc(
$res))
314 $roles_data[] =
$row;
316 return $roles_data ? $roles_data :
array();
330 if ($a_templates ===
true)
332 $where =
"WHERE ".$ilDB->in(
'object_data.type',
array(
'role',
'rolt'),
false,
'text').
" ";
336 $where =
"WHERE ".$ilDB->in(
'object_data.type',
array(
'role'),
false,
'text').
" ";
356 foreach ($a_role_list as $key => $val)
359 if ($val[
"type"] ==
"rolt")
361 $a_role_list[$key][
"role_type"] =
"template";
365 if ($val[
"assign"] ==
"y")
367 if ($val[
"parent"] == ROLE_FOLDER_ID)
369 $a_role_list[$key][
"role_type"] =
"global";
373 $a_role_list[$key][
"role_type"] =
"local";
378 $a_role_list[$key][
"role_type"] =
"linked";
382 if ($val[
"protected"] ==
"y")
384 $a_role_list[$key][
"protected"] =
true;
388 $a_role_list[$key][
"protected"] =
false;
406 $query =
'SELECT COUNT(DISTINCT(usr_id)) as num FROM rbac_ua '.
407 'WHERE '.$ilDB->in(
'rol_id', $a_roles,
false,
'integer').
' ';
425 if (!isset($a_rol_id))
427 $message = get_class($this).
"::assignedUsers(): No role_id given!";
428 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
430 if(isset(self::$assigned_users_cache[$a_rol_id]))
432 return self::$assigned_users_cache[$a_rol_id];
435 $result_arr =
array();
437 $query =
"SELECT usr_id FROM rbac_ua WHERE rol_id= ".$ilDB->quote($a_rol_id,
'integer');
439 while(
$row = $ilDB->fetchAssoc(
$res))
441 array_push($result_arr,
$row[
"usr_id"]);
444 self::$assigned_users_cache[$a_rol_id] = $result_arr;
460 if(isset(self::$is_assigned_cache[$a_role_id][$a_usr_id])) {
461 return self::$is_assigned_cache[$a_role_id][$a_usr_id];
466 $ilDB->setLimit(1,0);
467 $query =
"SELECT usr_id FROM rbac_ua WHERE ".
468 "rol_id= ".$ilDB->quote($a_role_id,
'integer').
" ".
469 "AND usr_id= ".$ilDB->quote($a_usr_id);
472 $is_assigned =
$res->numRows() == 1;
473 self::$is_assigned_cache[$a_role_id][$a_usr_id] = $is_assigned;
494 $ilDB->setLimit(1,0);
495 $query =
"SELECT usr_id FROM rbac_ua WHERE ".
496 $ilDB->in(
'rol_id',$a_role_ids,
false,
'integer').
497 " AND usr_id= ".$ilDB->quote($a_usr_id);
500 return $ilDB->numRows(
$res) == 1;
516 $query =
"SELECT rol_id FROM rbac_ua WHERE usr_id = ".$ilDB->quote($a_usr_id,
'integer');
519 while(
$row = $ilDB->fetchObject(
$res))
521 $role_arr[] =
$row->rol_id;
523 return $role_arr ? $role_arr :
array();
535 $query =
"SELECT ua.rol_id FROM rbac_ua ua ".
536 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
537 "WHERE usr_id = ".$ilDB->quote($a_usr_id,
'integer').
' '.
538 "AND parent = ".$ilDB->quote(ROLE_FOLDER_ID).
" ".
542 while(
$row = $ilDB->fetchObject(
$res))
544 $role_arr[] =
$row->rol_id;
546 return $role_arr ? $role_arr :
array();
561 $ilBench->start(
"RBAC",
"review_isAssignable");
564 if ($a_rol_id == SYSTEM_ROLE_ID)
566 $ilBench->stop(
"RBAC",
"review_isAssignable");
570 if (!isset($a_rol_id)
or !isset($a_ref_id))
572 $message = get_class($this).
"::isAssignable(): Missing parameter!".
573 " role_id: ".$a_rol_id.
" ,ref_id: ".$a_ref_id;
574 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
576 $query =
"SELECT * FROM rbac_fa ".
577 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
578 "AND parent = ".$ilDB->quote($a_ref_id,
'integer').
" ";
582 $ilBench->stop(
"RBAC",
"review_isAssignable");
583 return $row->assign ==
'y' ? true :
false;
595 $query =
"SELECT * FROM rbac_fa WHERE rol_id = ".$ilDB->quote($a_role_id,
'integer').
' '.
596 "AND assign = ".$ilDB->quote(
'y',
'text');
598 return $res->numRows() > 1;
616 if (!isset($a_rol_id))
618 $message = get_class($this).
"::getFoldersAssignedToRole(): No role_id given!";
619 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
624 $where =
" AND assign ='y'";
627 $query =
"SELECT DISTINCT parent FROM rbac_fa ".
628 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".$where.
" ";
631 while(
$row = $ilDB->fetchObject(
$res))
633 $folders[] =
$row->parent;
635 return $folders ? $folders :
array();
649 if(!isset($a_ref_id))
654 if($a_assignable_only === TRUE)
656 $and =
'AND assign = '.$ilDB->quote(
'y',
'text');
658 $query =
"SELECT rol_id FROM rbac_fa ".
659 "WHERE parent = ".$ilDB->quote($a_ref_id,
'integer').
" ".
665 while(
$row = $ilDB->fetchObject(
$res))
667 $role_ids[] =
$row->rol_id;
689 $ilBench->start(
"RBAC",
"review_getRolesOfRoleFolder");
691 if (!isset($a_ref_id))
693 $message = get_class($this).
"::getRolesOfRoleFolder(): No ref_id given!";
695 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
699 if ($a_nonassignable ===
false)
701 $and =
" AND assign='y'";
704 $query =
"SELECT rol_id FROM rbac_fa ".
705 "WHERE parent = ".$ilDB->quote($a_ref_id,
'integer').
" ".
709 while(
$row = $ilDB->fetchObject(
$res))
711 $rol_id[] =
$row->rol_id;
714 $ilBench->stop(
"RBAC",
"review_getRolesOfRoleFolder");
716 return $rol_id ? $rol_id :
array();
744 $lroles[] = $role_id;
760 $lroles[] = $role_id;
775 $ga[] =
array(
'obj_id' => $role_id,
776 'role_type' =>
'global');
778 return $ga ? $ga :
array();
789 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
795 $ga[] =
array(
'obj_id' => $role_id,
796 'role_type' =>
'global');
799 return $ga ? $ga :
array();
809 global $rbacreview,
$ilDB;
811 $query =
'SELECT * FROM rbac_fa '.
812 'WHERE rol_id = '.$ilDB->quote($a_role_id,
'integer').
' '.
813 'AND parent = '.$ilDB->quote($a_parent_id,
'integer');
815 return $res->numRows() ? true :
false;
828 $query =
'SELECT * FROM rbac_operations ORDER BY ops_id ';
830 while(
$row = $ilDB->fetchObject(
$res))
833 'operation' =>
$row->operation,
834 'description' =>
$row->description);
837 return $ops ? $ops :
array();
850 $query =
'SELECT * FROM rbac_operations WHERE ops_id = '.$ilDB->quote($ops_id,
'integer');
852 while(
$row = $ilDB->fetchObject(
$res))
855 'operation' =>
$row->operation,
856 'description' =>
$row->description);
859 return $ops ? $ops :
array();
877 $a_parent = ROLE_FOLDER_ID;
880 $query =
"SELECT ops_id,type FROM rbac_templates ".
881 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
882 "AND parent = ".$ilDB->quote($a_parent,
'integer');
886 while (
$row = $ilDB->fetchObject(
$res))
888 $ops_arr[
$row->type][] =
$row->ops_id;
890 return (
array) $ops_arr;
904 $query =
'SELECT * FROM rbac_pa '.
905 'WHERE ref_id = '.$ilDB->quote($a_ref_id,
'integer').
' '.
906 'AND rol_id = '.$ilDB->quote($a_role_id,
'integer').
' ';
911 return unserialize(
$row[
'ops_id']);
931 if (!isset($a_rol_id)
or !isset(
$a_type))
933 $message = get_class($this).
"::getOperationsOfRole(): Missing Parameter!".
934 "role_id: ".$a_rol_id.
936 "parent_id: ".$a_parent;
937 $ilLog->logStack(
"Missing parameter! ");
938 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
946 $a_parent = ROLE_FOLDER_ID;
949 $query =
"SELECT ops_id FROM rbac_templates ".
950 "WHERE type =".$ilDB->quote(
$a_type,
'text').
" ".
951 "AND rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
952 "AND parent = ".$ilDB->quote($a_parent,
'integer');
954 while (
$row = $ilDB->fetchObject(
$res))
956 $ops_arr[] =
$row->ops_id;
973 $query =
"SELECT * FROM rbac_pa ".
974 "WHERE rol_id = ".$ilDB->quote($a_role_id,
'integer').
" ".
975 "AND ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ";
978 while(
$row = $ilDB->fetchObject(
$res))
980 $ops = unserialize(
$row->ops_id);
983 return $ops ? $ops :
array();
997 if (!isset($a_typ_id))
999 $message = get_class($this).
"::getOperationsOnType(): No type_id given!";
1000 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1003 #$query = "SELECT * FROM rbac_ta WHERE typ_id = ".$ilDB->quote($a_typ_id,'integer'); 1005 $query =
'SELECT * FROM rbac_ta ta JOIN rbac_operations o ON ta.ops_id = o.ops_id '.
1006 'WHERE typ_id = '.$ilDB->quote($a_typ_id,
'integer').
' '.
1007 'ORDER BY op_order';
1011 while(
$row = $ilDB->fetchObject(
$res))
1013 $ops_id[] =
$row->ops_id;
1016 return $ops_id ? $ops_id :
array();
1031 $query =
"SELECT * FROM object_data WHERE type = 'typ' AND title = ".$ilDB->quote(
$a_type ,
'text').
" ";
1053 if($a_class !=
'create')
1055 $condition =
"AND class != ".$ilDB->quote(
'create',
'text');
1059 $condition =
"AND class = ".$ilDB->quote(
'create',
'text');
1062 $query =
"SELECT ro.ops_id FROM rbac_operations ro ".
1063 "JOIN rbac_ta rt ON ro.ops_id = rt.ops_id ".
1064 "JOIN object_data od ON rt.typ_id = od.obj_id ".
1065 "WHERE type = ".$ilDB->quote(
'typ',
'text').
" ".
1066 "AND title = ".$ilDB->quote(
$a_type,
'text').
" ".
1068 "ORDER BY op_order ";
1075 $ops[] =
$row->ops_id;
1094 #$query = 'SELECT t.parent p FROM tree t JOIN rbac_fa fa ON fa.parent = child '. 1095 # 'WHERE assign = '.$ilDB->quote('n','text').' '. 1096 # 'AND rol_id = '.$ilDB->quote($a_rol_id,'integer').' '; 1098 $query =
'SELECT parent p FROM rbac_fa '.
1099 'WHERE assign = '.$ilDB->quote(
'n',
'text').
' '.
1100 'AND rol_id = '.$ilDB->quote($a_rol_id,
'integer').
' ';
1104 $query .= (
'AND '.$ilDB->in(
'parent',(
array) $a_filter,
false,
'integer'));
1111 $parent[] =
$row->p;
1127 $q =
"SELECT tree FROM tree WHERE child =".$ilDB->quote($a_node_id).
" ";
1134 $message = sprintf(
'%s::isDeleted(): Role folder with ref_id %s not found!',
1137 $this->log->write($message,$this->log->FATAL);
1180 case self::FILTER_ALL:
1185 case self::FILTER_ALL_GLOBAL:
1186 $where =
'WHERE '.$ilDB->in(
'rbac_fa.rol_id',$this->
getGlobalRoles(),
false,
'integer').
' ';
1190 case self::FILTER_ALL_LOCAL:
1191 case self::FILTER_INTERNAL:
1192 case self::FILTER_NOT_INTERNAL:
1193 $where =
'WHERE '.$ilDB->in(
'rbac_fa.rol_id',$this->
getGlobalRoles(),
true,
'integer');
1197 case self::FILTER_TEMPLATES:
1198 $where =
"WHERE object_data.type = 'rolt'";
1208 $where =
'WHERE '.$ilDB->in(
'rbac_fa.rol_id',$this->
assignedRoles($a_user_id),
false,
'integer').
' ';
1214 $query =
"SELECT * FROM object_data ".
1215 "JOIN rbac_fa ON obj_id = rol_id ".
1217 "AND rbac_fa.assign = ".$ilDB->quote($assign,
'text').
" ";
1219 if(strlen($title_filter))
1221 $query .= (
' AND '.$ilDB->like(
1224 '%'.$title_filter.
'%' 1229 while(
$row = $ilDB->fetchAssoc(
$res))
1231 $prefix = (substr(
$row[
"title"],0,3) ==
"il_") ?
true :
false;
1234 if ($a_filter == 4
and !$prefix)
1240 if ($a_filter == 5
and $prefix)
1245 $row[
"desc"] =
$row[
"description"];
1252 return $roles ? $roles :
array();
1266 $q =
"SELECT obj_id FROM object_data ".
1267 "WHERE title=".$ilDB->quote(
$a_type ,
'text').
" AND type='typ'";
1268 $r = $ilDB->query($q);
1271 return $row->obj_id;
1288 if(!count($operations))
1293 $query =
'SELECT ops_id FROM rbac_operations '.
1294 'WHERE '.$ilDB->in(
'operation',$operations,
false,
'text');
1297 while(
$row = $ilDB->fetchObject(
$res))
1299 $ops_ids[] =
$row->ops_id;
1301 return $ops_ids ? $ops_ids :
array();
1316 if (!isset($a_operation))
1318 $message =
"perm::getOperationId(): No operation given!";
1319 $ilErr->raiseError($message,$ilErr->WARNING);
1323 if (! is_array(self::$_opsCache)) {
1324 self::$_opsCache =
array();
1326 $q =
"SELECT ops_id, operation FROM rbac_operations";
1327 $r = $ilDB->query($q);
1330 self::$_opsCache[
$row->operation] =
$row->ops_id;
1335 if (array_key_exists($a_operation, self::$_opsCache)) {
1336 return self::$_opsCache[$a_operation];
1351 $operations =
array();
1352 foreach($a_type_arr as $type)
1354 $operations[] = (
'create_'.$type);
1357 if(!count($operations))
1362 $query =
'SELECT ops_id, operation FROM rbac_operations '.
1363 'WHERE '.$ilDB->in(
'operation',$operations,
false,
'text');
1368 while(
$row = $ilDB->fetchObject(
$res))
1370 $type_arr = explode(
'_',
$row->operation);
1371 $type = $type_arr[1];
1373 $ops_ids[$type] =
$row->ops_id;
1393 $query =
"SELECT protected FROM rbac_fa ".
1394 "WHERE rol_id = ".$ilDB->quote($a_role_id,
'integer').
" ";
1412 $query =
'SELECT blocked from rbac_fa '.
1413 'WHERE rol_id = '. $ilDB->quote($a_role_id,
'integer').
' '.
1414 'AND parent = '.$ilDB->quote($a_ref_id,
'integer');
1418 return (
bool)
$row->blocked;
1430 global
$ilDB, $tree;
1436 $query =
'SELECT parent from rbac_fa '.
1437 'WHERE rol_id = '.$ilDB->quote($a_role_id,
'integer').
' '.
1438 'AND blocked = '.$ilDB->quote(1,
'integer');
1441 $parent_ids =
array();
1444 $parent_ids[] =
$row->parent;
1447 foreach($parent_ids as $parent_id)
1449 if($tree->isGrandChild($parent_id, $a_ref_id))
1477 if (in_array(SYSTEM_ROLE_ID,$this->
assignedRoles($ilUser->getId())))
1483 $leveladmin =
false;
1485 #vd("RoleHierarchy",$a_role_hierarchy); 1486 foreach ($a_role_hierarchy as $role_id => $rolf_id)
1489 #echo "<br/>ROLF: ".$rolf_id." ROLE_ID: ".$role_id." (".$a_parent_roles[$role_id]['title'].") "; 1492 if ($leveladmin ==
true)
1494 $a_parent_roles[$role_id][
'protected'] =
false;
1498 if ($a_parent_roles[$role_id][
'protected'] ==
true)
1500 $arr_lvl_roles_user = array_intersect($this->
assignedRoles($ilUser->getId()),array_keys($a_role_hierarchy,$rolf_id));
1502 #vd("intersection",$arr_lvl_roles_user); 1504 foreach ($arr_lvl_roles_user as $lvl_role_id)
1506 #echo "<br/>level_role: ".$lvl_role_id; 1507 #echo "<br/>a_ref_id: ".$a_ref_id; 1511 $rolf = $a_parent_roles[$role_id][
'parent'];
1512 #$parent_obj = $GLOBALS['tree']->getParentId($rolf); 1513 if ($rbacsystem->checkPermission($rolf,$lvl_role_id,
'edit_permission'))
1515 #echo "<br />Permission granted"; 1518 $a_parent_roles[$role_id][
'protected'] =
false;
1526 return $a_parent_roles;
1547 $query = sprintf(
'SELECT * FROM rbac_operations '.
1548 'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id '.
1549 'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id '.
1550 'WHERE object_data.title = %s '.
1551 'AND object_data.type = %s '.
1552 'ORDER BY op_order ASC',
1554 $ilDB->quote(
'typ',
'text'));
1558 $query =
'SELECT * FROM rbac_operations ORDER BY op_order ASC';
1561 while (
$row = $ilDB->fetchAssoc(
$res))
1564 "ops_id" =>
$row[
'ops_id'],
1565 "operation" =>
$row[
'operation'],
1566 "desc" =>
$row[
'description'],
1567 "class" =>
$row[
'class'],
1568 "order" =>
$row[
'op_order']
1584 foreach ($a_ops_arr as $ops)
1586 $arr[$ops[
'class']][] =
array (
'ops_id' => $ops[
'ops_id'],
1587 'name' => $ops[
'operation']
1605 static $obj_cache =
array();
1610 if(isset($obj_cache[$a_role_id])
and $obj_cache[$a_role_id])
1612 return $obj_cache[$a_role_id];
1615 $query =
'SELECT obr.obj_id FROM rbac_fa rfa '.
1616 'JOIN object_reference obr ON rfa.parent = obr.ref_id '.
1617 'WHERE assign = '.$ilDB->quote(
'y',
'text').
' '.
1618 'AND rol_id = '.$ilDB->quote($a_role_id,
'integer').
' '.
1619 'AND deleted IS NULL';
1621 #$query = "SELECT obr.obj_id FROM rbac_fa rfa ". 1622 # "JOIN tree ON rfa.parent = tree.child ". 1623 # "JOIN object_reference obr ON tree.parent = obr.ref_id ". 1624 # "WHERE tree.tree = 1 ". 1625 # "AND assign = 'y' ". 1626 # "AND rol_id = ".$ilDB->quote($a_role_id,'integer')." "; 1629 $obj_cache[$a_role_id] = 0;
1630 while(
$row = $ilDB->fetchObject(
$res))
1632 $obj_cache[$a_role_id] =
$row->obj_id;
1634 return $obj_cache[$a_role_id];
1647 $query =
'SELECT parent p_ref FROM rbac_fa '.
1648 'WHERE rol_id = '.$ilDB->quote($a_role_id,
'integer').
' '.
1649 'AND assign = '.$ilDB->quote(
'y',
'text');
1670 if (count($rolf_list))
1672 foreach ($rolf_list as $rolf) {
1696 $role_list =
array();
1700 $query =
"SELECT * FROM object_data ".
1701 "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id ".
1703 "AND rbac_fa.assign = 'y' " .
1704 'AND '.$ilDB->in(
'object_data.obj_id',$role_ids,
false,
'integer');
1707 while(
$row = $ilDB->fetchAssoc(
$res))
1709 $row[
"desc"] =
$row[
"description"];
1711 $role_list[] =
$row;
1727 $query =
'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta '.
1728 'JOIN object_data obj ON obj.obj_id = ta.typ_id '.
1729 'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1733 while(
$row = $ilDB->fetchObject(
$res))
1758 if($a_role_id == SYSTEM_ROLE_ID
or $a_role_id == ANONYMOUS_ROLE_ID)
1778 return substr(
$title,0,3) ==
'il_' ? true :
false;
1795 $and = (
'AND assign = '.$ilDB->quote(
'y',
'text'));
1802 $query =
'SELECT * FROM rbac_fa '.
1803 'WHERE rol_id = '.$ilDB->quote($a_role_id,
'integer').
' '.
1808 return $row->parent;
1824 $query =
"SELECT ops_id FROM rbac_pa JOIN rbac_ua ".
1825 "ON (rbac_pa.rol_id = rbac_ua.rol_id) ".
1826 "WHERE rbac_ua.usr_id = ".$ilDB->quote($a_user_id,
'integer').
" ".
1827 "AND rbac_pa.ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ";
1831 while (
$row = $ilDB->fetchObject(
$res))
1833 $ops = unserialize(
$row->ops_id);
1834 $all_ops = array_merge($all_ops, $ops);
1836 $all_ops = array_unique($all_ops);
1838 $set = $ilDB->query(
"SELECT operation FROM rbac_operations ".
1839 " WHERE ".$ilDB->in(
"ops_id", $all_ops,
false,
"integer"));
1841 while ($rec = $ilDB->fetchAssoc($set))
1843 $perms[] = $rec[
"operation"];
1857 self::$is_assigned_cache[$a_role_id][$a_user_id] = $a_value;
1868 return self::$is_assigned_cache[$a_role_id][$a_user_id];
1876 self::$is_assigned_cache =
array();
1877 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.
getNumberOfAssignedUsers(Array $a_roles)
Get the number of assigned users to roles ilDB $ilDB.
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.
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)
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.
getRolesOfObject($a_ref_id, $a_assignable_only=FALSE)
Get roles of object.
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
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
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.