59 (isset($ilDB)) ? $this->
ilDB =& $ilDB : $this->
ilDB =& $ilias->db;
124 include_once
"Services/Mail/classes/class.ilMail.php";
127 require_once
'Mail/RFC822.php';
128 $parser = &
new Mail_RFC822();
129 $parsedList = $parser->parseAddressList($a_address_list,
"ilias",
false,
true);
133 $local_part = $address->mailbox;
134 if (strpos($local_part,
'#') !== 0 &&
135 !($local_part{0} ==
'"' && $local_part{1} ==
"#"))
142 $local_part = substr($local_part, 1);
146 if( $local_part{0} ==
'#' && $local_part{strlen($local_part) - 1} ==
'"' )
148 $local_part = substr($local_part, 1);
149 $local_part = substr($local_part, 0, strlen($local_part) - 1);
152 if (substr($local_part,0,8) ==
'il_role_')
154 $role_id = substr($local_part,8);
155 $query =
"SELECT t.tree ".
157 "JOIN tree t ON t.child = fa.parent ".
158 "WHERE fa.rol_id = ".$this->ilDB->quote($role_id,
'integer').
" ".
159 "AND fa.assign = 'y' ".
161 $r = $ilDB->query(
$query);
162 if ($r->numRows() > 0)
164 $role_ids[] = $role_id;
170 $domain = $address->host;
171 if (strpos($domain,
'[') == 0 && strrpos($domain,
']'))
173 $domain = substr($domain,1,strlen($domain) - 2);
175 if (strlen($local_part) == 0)
177 $local_part = $domain;
178 $address->host =
'ilias';
182 if (strtolower($address->host) ==
'ilias')
185 $query =
"SELECT dat.obj_id ".
186 "FROM object_data dat ".
187 "JOIN rbac_fa fa ON fa.rol_id = dat.obj_id ".
188 "JOIN tree t ON t.child = fa.parent ".
189 "WHERE dat.title =".$this->ilDB->quote($local_part,
'text').
" ".
190 "AND dat.type = 'role' ".
191 "AND fa.assign = 'y' ".
197 $query =
"SELECT rdat.obj_id ".
198 "FROM object_data odat ".
199 "JOIN object_reference oref ON oref.obj_id = odat.obj_id ".
200 "JOIN tree otree ON otree.child = oref.ref_id ".
201 "JOIN tree rtree ON rtree.parent = otree.child ".
202 "JOIN rbac_fa rfa ON rfa.parent = rtree.child ".
203 "JOIN object_data rdat ON rdat.obj_id = rfa.rol_id ".
204 "WHERE odat.title = ".$this->ilDB->quote($domain,
'text').
" ".
205 "AND otree.tree = 1 AND rtree.tree = 1 ".
206 "AND rfa.assign = 'y' ".
207 "AND rdat.title LIKE ".
208 $this->
ilDB->
quote(
'%'.preg_replace(
'/([_%])/',
'\\\\$1',$local_part).
'%',
'text');
210 $r = $ilDB->query(
$query);
215 $role_ids[] =
$row->obj_id;
221 if ($count == 0 && strtolower($address->host) ==
'ilias')
223 $q =
"SELECT dat.obj_id ".
224 "FROM object_data dat ".
225 "JOIN object_reference ref ON ref.obj_id = dat.obj_id ".
226 "JOIN tree t ON t.child = ref.ref_id ".
227 "WHERE dat.title = ".$this->ilDB->quote($domain ,
'text').
" ".
228 "AND dat.type = 'role' ".
234 $role_ids[] =
$row->obj_id;
245 $titles = explode(
',', $a_address_list);
248 foreach ($titles as
$title)
250 if (strlen($inList) > 0)
254 $title = trim($title);
255 if (strpos($title,
'#') == 0)
257 $titleList .= $this->
ilDB->
quote(substr($title, 1));
260 if (strlen($titleList) > 0)
262 $q =
"SELECT obj_id ".
264 "WHERE title IN (".$titleList.
") ".
269 $role_ids[] =
$row->obj_id;
344 include_once
"Services/Mail/classes/class.ilMail.php";
348 $query =
"SELECT rdat.title role_title,odat.title object_title, ".
349 " oref.ref_id object_ref ".
350 "FROM object_data rdat ".
351 "JOIN rbac_fa fa ON fa.rol_id = rdat.obj_id ".
352 "JOIN tree rtree ON rtree.child = fa.parent ".
353 "JOIN object_reference oref ON oref.ref_id = rtree.parent ".
354 "JOIN object_data odat ON odat.obj_id = oref.obj_id ".
355 "WHERE rdat.obj_id = ".$this->ilDB->quote($a_role_id,
'integer').
" ".
356 "AND fa.assign = 'y' ";
357 $r = $ilDB->query(
$query);
358 if (!
$row = $ilDB->fetchObject($r))
363 $object_title =
$row->object_title;
364 $object_ref =
$row->object_ref;
365 $role_title =
$row->role_title;
371 $domain = $object_title;
372 $local_part = $role_title;
376 $q =
"SELECT COUNT(DISTINCT dat.obj_id) count ".
377 "FROM object_data dat ".
378 "JOIN object_reference ref ON ref.obj_id = dat.obj_id ".
379 "JOIN tree ON tree.child = ref.ref_id ".
380 "WHERE title = ".$this->ilDB->quote($object_title,
'text').
" ".
381 "AND tree.tree = 1 ";
392 if (domain != null && preg_match(
'/[\[\]\\]|[\x00-\x1f]/',$domain))
399 if ($domain != null &&
400 (preg_match(
'/[()<>@,;:\\".\[\]]/',$domain) ||
401 preg_match(
'/[^\x21-\x8f]/',$domain))
404 $domain =
'['.$domain.
']';
410 if (strpos($role_title,
'il_') === 0 && $domain != null)
412 $unambiguous_role_title = $role_title;
414 $pos = strpos($role_title,
'_', 3) + 1;
415 $local_part = substr(
418 strrpos($role_title,
'_') - $pos
423 $unambiguous_role_title =
'il_role_'.$a_role_id;
432 $q =
"SELECT COUNT(DISTINCT dat.obj_id) count ".
433 "FROM object_data dat ".
434 "JOIN object_reference ref ON ref.obj_id = dat.obj_id ".
435 "JOIN tree ON tree.child = ref.ref_id ".
436 "WHERE title = ".$this->ilDB->quote($local_part,
'text').
" ".
437 "AND tree.tree = 1 ";
441 $q =
"SELECT COUNT(rd.obj_id) count ".
442 "FROM object_data rd ".
443 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id ".
444 "JOIN tree t ON t.child = fa.parent ".
445 "WHERE fa.assign = 'y' ".
446 "AND t.parent = ".$this->ilDB->quote($object_ref,
'integer').
" ".
447 "AND rd.title LIKE ".$this->ilDB->quote(
448 '%'.preg_replace(
'/([_%])/',
'\\\\$1', $local_part).
'%',
'text').
" ";
458 $local_part = $unambiguous_role_title;
464 if (preg_match(
'/[\\"\x00-\x1f]/',$local_part))
466 $local_part = $unambiguous_role_title;
471 $local_part =
'#'.$local_part;
474 if (preg_match(
'/[()<>@,;:.\[\]\x20]/',$local_part))
476 $local_part =
'"'.$local_part.
'"';
479 $mailbox = ($domain == null) ?
481 $local_part.
'@'.$domain;
485 if (substr($role_title,0,3) ==
'il_')
487 $phrase = $lng->txt(substr($role_title, 0, strrpos($role_title,
'_')));
491 $phrase = $role_title;
497 $phrase = preg_replace(
'/\s\s+/',
' ', $phrase);
498 $phrase = preg_replace(
'/[()<>@,;:\\".\[\]]/',
'', $phrase);
500 $mailbox = $phrase.
' <'.$mailbox.
'>';
507 $q =
"SELECT title ".
509 "WHERE obj_id = ".$this->ilDB->quote($a_role_id ,
'integer');
514 return '#'.$row->title;
537 $message = get_class($this).
"::roleExists(): No title given!";
538 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
541 $clause = ($a_id) ?
" AND obj_id != ".$ilDB->quote($a_id).
" " :
"";
543 $q =
"SELECT DISTINCT(obj_id) obj_id FROM object_data ".
544 "WHERE title =".$ilDB->quote($a_title).
" ".
545 "AND type IN('role','rolt')".
567 $parent_roles = array();
568 $role_hierarchy = array();
570 $node = $tree->getNodeData($a_path);
576 $relevant_rolfs[] = ROLE_FOLDER_ID;
581 $relevant_rolfs[] = $rolf;
585 $query =
"SELECT * FROM tree ".
586 "JOIN object_reference obr ON child = ref_id ".
587 "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
588 "WHERE type = 'rolf' ".
589 "AND lft < ".$ilDB->quote($lft,
'integer').
" ".
590 "AND rgt > ".$ilDB->quote($rgt,
'integer');
596 $relevant_rolfs[] =
$row->child;
598 foreach($relevant_rolfs as $rolf)
602 foreach ($roles as $role)
604 $id = $role[
"obj_id"];
605 $role[
"parent"] = $rolf;
606 $parent_roles[$id] = $role;
608 if (!array_key_exists($role[
'obj_id'],$role_hierarchy))
610 $role_hierarchy[$id] = $rolf;
615 if (!$a_keep_protected)
619 return $parent_roles;
639 if (!isset($a_path) or !is_array($a_path))
641 $message = get_class($this).
"::getParentRoles(): No path given or wrong datatype!";
642 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
645 $parent_roles = array();
646 $role_hierarchy = array();
650 $in = $ilDB->in(
't.parent',$a_path,
false,
'integer');
652 $q =
"SELECT t.child,t.depth FROM tree t ".
653 "JOIN object_reference r ON r.ref_id = t.child ".
654 "JOIN object_data o ON o.obj_id = r.obj_id ".
656 "AND o.type= ".$ilDB->quote(
'rolf',
'text').
" ".
657 "ORDER BY t.depth ASC";
662 $role_rows = array();
666 $depth = (
$row->child == ROLE_FOLDER_ID ? 0 :
$row->depth);
667 $role_rows[$depth][
'child'] =
$row->child;
669 ksort($role_rows,SORT_NUMERIC);
670 foreach($role_rows as
$row)
673 foreach ($roles as $role)
675 $id = $role[
"obj_id"];
676 $role[
"parent"] = $row[
'child'];
677 $parent_roles[$id] = $role;
679 if (!array_key_exists($role[
'obj_id'],$role_hierarchy))
681 $role_hierarchy[$id] = $row[
'child'];
685 if (!$a_keep_protected)
689 return $parent_roles;
704 if (!isset($a_endnode_id))
706 $message = get_class($this).
"::getParentRoleIds(): No node_id (ref_id) given!";
707 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
712 $pathIds = $tree->getPathId($a_endnode_id);
715 $pathIds[0] = SYSTEM_FOLDER_ID;
717 #return $this->getParentRoles($a_endnode_id,$a_templates,$a_keep_protected);
732 if (!isset($a_ref_id) or !isset($a_templates))
734 $message = get_class($this).
"::getRoleListByObject(): Missing parameter!".
735 "ref_id: ".$a_ref_id.
736 "tpl_flag: ".$a_templates;
737 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
740 $role_list = array();
744 $query =
"SELECT * FROM object_data ".
745 "JOIN rbac_fa ON obj_id = rol_id ".
747 "AND object_data.obj_id = rbac_fa.rol_id ".
748 "AND rbac_fa.parent = ".$ilDB->quote($a_ref_id,
'integer').
" ";
751 while (
$row = $ilDB->fetchAssoc(
$res))
773 $role_list = array();
777 $query =
"SELECT * FROM object_data ".
778 "JOIN rbac_fa ON obj_id = rol_id ".
780 "AND rbac_fa.assign = 'y' ";
783 while (
$row = $ilDB->fetchAssoc(
$res))
805 $role_list = array();
808 $query =
"SELECT fa.*, dat.* ".
810 "JOIN tree node ON node.tree = root.tree ".
811 "AND node.lft > root.lft AND node.rgt < root.rgt ".
812 "JOIN object_reference ref ON ref.ref_id = node.child ".
813 "JOIN rbac_fa fa ON fa.parent = ref.ref_id ".
814 "JOIN object_data dat ON dat.obj_id = fa.rol_id ".
815 "WHERE root.child = ".$this->ilDB->quote(
$ref_id,
'integer').
" ".
816 "AND root.tree = 1 ".
817 "AND fa.assign = 'y' ".
818 "ORDER BY dat.title";
821 while(
$row = $ilDB->fetchAssoc(
$res))
841 $query =
"SELECT fa.*, rd.* ".
842 "FROM object_data rd ".
843 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id ".
844 "JOIN tree t ON t.child = fa.parent ".
845 "WHERE fa.assign = 'y' ".
846 "AND t.parent = ".$this->ilDB->quote($a_ref_id,
'integer').
" "
849 while(
$row = $ilDB->fetchAssoc(
$res))
851 $roles_data[] =
$row;
853 return $roles_data ? $roles_data : array();
866 if ($a_templates ===
true)
868 $where =
"WHERE ".$ilDB->in(
'object_data.type',array(
'role',
'rolt'),
false,
'text').
" ";
872 $where =
"WHERE ".$ilDB->in(
'object_data.type',array(
'role'),
false,
'text').
" ";
891 foreach ($a_role_list as
$key => $val)
894 if ($val[
"type"] ==
"rolt")
896 $a_role_list[
$key][
"role_type"] =
"template";
900 if ($val[
"assign"] ==
"y")
902 if ($val[
"parent"] == ROLE_FOLDER_ID)
904 $a_role_list[
$key][
"role_type"] =
"global";
908 $a_role_list[
$key][
"role_type"] =
"local";
913 $a_role_list[
$key][
"role_type"] =
"linked";
917 if ($val[
"protected"] ==
"y")
919 $a_role_list[
$key][
"protected"] =
true;
923 $a_role_list[
$key][
"protected"] =
false;
941 $ilBench->start(
"RBAC",
"review_assignedUsers");
943 if (!isset($a_rol_id))
945 $message = get_class($this).
"::assignedUsers(): No role_id given!";
946 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
949 $result_arr = array();
951 if ($a_fields !== NULL and is_array($a_fields))
953 if (count($a_fields) == 0)
959 if (($usr_id_field = array_search(
"usr_id",$a_fields)) !==
false)
960 unset($a_fields[$usr_id_field]);
962 $select = implode(
",",$a_fields).
",usr_data.usr_id";
963 $select = addslashes($select);
966 $query =
"SELECT ".$select.
" FROM usr_data ".
967 "LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id ".
968 "WHERE rbac_ua.rol_id =".$ilDB->quote($a_rol_id,
'integer');
970 while(
$row = $ilDB->fetchAssoc(
$res))
972 $result_arr[] =
$row;
977 $query =
"SELECT usr_id FROM rbac_ua WHERE rol_id= ".$ilDB->quote($a_rol_id,
'integer');
980 while(
$row = $ilDB->fetchAssoc(
$res))
982 array_push($result_arr,
$row[
"usr_id"]);
986 $ilBench->stop(
"RBAC",
"review_assignedUsers");
1003 $ilDB->setLimit(1,0);
1004 $query =
"SELECT usr_id FROM rbac_ua WHERE ".
1005 "rol_id= ".$ilDB->quote($a_role_id,
'integer').
" ".
1006 "AND usr_id= ".$ilDB->quote($a_usr_id);
1009 return $res->numRows() == 1;
1027 $ilDB->setLimit(1,0);
1028 $query =
"SELECT usr_id FROM rbac_ua WHERE ".
1029 $ilDB->in(
'rol_id',$a_role_ids,
false,
'integer').
1030 " AND usr_id= ".$ilDB->quote($a_usr_id);
1033 return $ilDB->numRows(
$res) == 1;
1046 $role_arr = array();
1048 $query =
"SELECT rol_id FROM rbac_ua WHERE usr_id = ".$ilDB->quote($a_usr_id,
'integer');
1051 while(
$row = $ilDB->fetchObject(
$res))
1053 $role_arr[] =
$row->rol_id;
1055 return $role_arr ? $role_arr : array();
1066 $query =
"SELECT ua.rol_id FROM rbac_ua ua ".
1067 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
1068 "WHERE usr_id = ".$ilDB->quote($a_usr_id,
'integer').
' '.
1069 "AND parent = ".$ilDB->quote(ROLE_FOLDER_ID).
" ".
1070 "AND assign = 'y' ";
1073 while(
$row = $ilDB->fetchObject(
$res))
1075 $role_arr[] =
$row->rol_id;
1077 return $role_arr ? $role_arr : array();
1091 $ilBench->start(
"RBAC",
"review_isAssignable");
1094 if ($a_rol_id == SYSTEM_ROLE_ID)
1096 $ilBench->stop(
"RBAC",
"review_isAssignable");
1100 if (!isset($a_rol_id) or !isset($a_ref_id))
1102 $message = get_class($this).
"::isAssignable(): Missing parameter!".
1103 " role_id: ".$a_rol_id.
" ,ref_id: ".$a_ref_id;
1104 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1106 $query =
"SELECT * FROM rbac_fa ".
1107 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
1108 "AND parent = ".$ilDB->quote($a_ref_id,
'integer').
" ";
1112 $ilBench->stop(
"RBAC",
"review_isAssignable");
1113 return $row->assign ==
'y' ?
true :
false;
1130 if (!isset($a_rol_id))
1132 $message = get_class($this).
"::getFoldersAssignedToRole(): No role_id given!";
1133 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1138 $where =
" AND assign ='y'";
1141 $query =
"SELECT DISTINCT parent FROM rbac_fa ".
1142 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".$where.
" ";
1145 while(
$row = $ilDB->fetchObject(
$res))
1147 $folders[] =
$row->parent;
1149 return $folders ? $folders : array();
1164 $ilBench->start(
"RBAC",
"review_getRolesOfRoleFolder");
1166 if (!isset($a_ref_id))
1168 $message = get_class($this).
"::getRolesOfRoleFolder(): No ref_id given!";
1169 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1173 if ($a_nonassignable ===
false)
1175 $and =
" AND assign='y'";
1178 $query =
"SELECT rol_id FROM rbac_fa ".
1179 "WHERE parent = ".$ilDB->quote($a_ref_id,
'integer').
" ".
1183 while(
$row = $ilDB->fetchObject(
$res))
1185 $rol_id[] =
$row->rol_id;
1188 $ilBench->stop(
"RBAC",
"review_getRolesOfRoleFolder");
1190 return $rol_id ? $rol_id : array();
1212 $ga[] = array(
'obj_id' => $role_id,
1213 'role_type' =>
'global');
1215 return $ga ? $ga : array();
1225 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
1231 $ga[] = array(
'obj_id' => $role_id,
1232 'role_type' =>
'global');
1235 return $ga ? $ga : array();
1247 $query =
"SELECT DISTINCT parent FROM rbac_fa";
1251 while(
$row = $ilDB->fetchObject(
$res))
1253 $parent[] =
$row->parent;
1268 $ilBench->start(
"RBAC",
"review_getRoleFolderOfObject");
1270 if (!isset($a_ref_id))
1273 $message = get_class($this).
"::getRoleFolderOfObject(): No ref_id given!";
1274 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1276 $childs = $tree->getChildsByType($a_ref_id,
"rolf");
1278 $ilBench->stop(
"RBAC",
"review_getRoleFolderOfObject");
1280 return $childs[0] ? $childs[0] : array();
1292 return $rolf[
'ref_id'];
1304 $query =
'SELECT * FROM rbac_operations ORDER BY ops_id ';
1306 while(
$row = $ilDB->fetchObject(
$res))
1308 $ops[] = array(
'ops_id' =>
$row->ops_id,
1309 'operation' =>
$row->operation,
1310 'description' =>
$row->description);
1313 return $ops ? $ops : array();
1325 $query =
'SELECT * FROM rbac_operations WHERE ops_id = '.$ilDB->quote($ops_id,
'integer');
1327 while(
$row = $ilDB->fetchObject(
$res))
1329 $ops = array(
'ops_id' =>
$row->ops_id,
1330 'operation' =>
$row->operation,
1331 'description' =>
$row->description);
1334 return $ops ? $ops : array();
1351 $a_parent = ROLE_FOLDER_ID;
1354 $query =
"SELECT ops_id,type FROM rbac_templates ".
1355 "WHERE rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
1356 "AND parent = ".$ilDB->quote($a_parent,
'integer');
1358 while (
$row = $ilDB->fetchObject(
$res))
1360 $ops_arr[
$row->type][] =
$row->ops_id;
1362 return (array) $ops_arr;
1379 if (!isset($a_rol_id) or !isset($a_type))
1381 $message = get_class($this).
"::getOperationsOfRole(): Missing Parameter!".
1382 "role_id: ".$a_rol_id.
1384 "parent_id: ".$a_parent;
1385 $ilLog->logStack(
"Missing parameter! ");
1386 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1394 $a_parent = ROLE_FOLDER_ID;
1397 $query =
"SELECT ops_id FROM rbac_templates ".
1398 "WHERE type =".$ilDB->quote($a_type,
'text').
" ".
1399 "AND rol_id = ".$ilDB->quote($a_rol_id,
'integer').
" ".
1400 "AND parent = ".$ilDB->quote($a_parent,
'integer');
1402 while (
$row = $ilDB->fetchObject(
$res))
1404 $ops_arr[] =
$row->ops_id;
1414 $query =
"SELECT * FROM rbac_pa ".
1415 "WHERE rol_id = ".$ilDB->quote($a_role_id,
'integer').
" ".
1416 "AND ref_id = ".$ilDB->quote($a_ref_id,
'integer').
" ";
1419 while(
$row = $ilDB->fetchObject(
$res))
1421 $ops = unserialize(
$row->ops_id);
1424 return $ops ? $ops : array();
1437 if (!isset($a_typ_id))
1439 $message = get_class($this).
"::getOperationsOnType(): No type_id given!";
1440 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1443 $query =
"SELECT * FROM rbac_ta WHERE typ_id = ".$ilDB->quote($a_typ_id,
'integer');
1446 while(
$row = $ilDB->fetchObject(
$res))
1448 $ops_id[] =
$row->ops_id;
1451 return $ops_id ? $ops_id : array();
1464 $query =
"SELECT * FROM object_data WHERE type = 'typ' AND title = ".$ilDB->quote($a_type ,
'text').
" ";
1482 $tree =
new ilTree(ROOT_FOLDER_ID);
1484 if (!isset($a_rol_id))
1486 $message = get_class($this).
"::getObjectsWithStopedInheritance(): No role_id given!";
1487 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1492 foreach ($all_rolf_ids as $rolf_id)
1494 $parent[] = $tree->getParentId($rolf_id);
1497 return $parent ? $parent : array();
1510 $q =
"SELECT tree FROM tree WHERE child =".$ilDB->quote($a_node_id).
" ";
1517 $message = sprintf(
'%s::isDeleted(): Role folder with ref_id %s not found!',
1520 $this->log->write($message,$this->log->FATAL);
1554 $where =
'WHERE '.$ilDB->in(
'rbac_fa.rol_id',$this->
getGlobalRoles(),
false,
'integer').
' ';
1561 $where =
'WHERE '.$ilDB->in(
'rbac_fa.rol_id',$this->
getGlobalRoles(),
true,
'integer');
1566 $where =
"WHERE object_data.type = 'rolt'";
1576 $where =
'WHERE '.$ilDB->in(
'rbac_fa.rol_id',$this->
assignedRoles($a_user_id),
false,
'integer').
' ';
1582 $query =
"SELECT * FROM object_data ".
1583 "JOIN rbac_fa ON obj_id = rol_id ".
1585 "AND rbac_fa.assign = ".$ilDB->quote($assign,
'text').
" ";
1588 while(
$row = $ilDB->fetchAssoc(
$res))
1590 $prefix = (substr(
$row[
"title"],0,3) ==
"il_") ?
true :
false;
1593 if ($a_filter == 4 and !$prefix)
1599 if ($a_filter == 5 and $prefix)
1604 $row[
"desc"] =
$row[
"description"];
1611 return $roles ? $roles : array();
1619 $q =
"SELECT obj_id FROM object_data ".
1620 "WHERE title=".$ilDB->quote($a_type ,
'text').
" AND type='typ'";
1621 $r = $ilDB->query(
$q);
1624 return $row->obj_id;
1640 if(!count($operations))
1645 $query =
'SELECT ops_id FROM rbac_operations '.
1646 'WHERE '.$ilDB->in(
'operation',$operations,
false,
'text');
1649 while(
$row = $ilDB->fetchObject(
$res))
1651 $ops_ids[] =
$row->ops_id;
1653 return $ops_ids ? $ops_ids : array();
1667 if (!isset($a_operation))
1669 $message =
"perm::getOperationId(): No operation given!";
1670 $ilErr->raiseError($message,$ilErr->WARNING);
1674 if (! is_array(self::$_opsCache)) {
1675 self::$_opsCache = array();
1677 $q =
"SELECT ops_id, operation FROM rbac_operations";
1678 $r = $ilDB->query(
$q);
1681 self::$_opsCache[
$row->operation] =
$row->ops_id;
1686 if (array_key_exists($a_operation, self::$_opsCache)) {
1687 return self::$_opsCache[$a_operation];
1705 if (!isset($a_ref_id))
1707 $message = get_class($this).
"::getLinkedRolesOfRoleFolder(): No ref_id given!";
1708 $this->ilErr->raiseError($message,$this->ilErr->WARNING);
1711 $and =
" AND assign='n'";
1713 $query =
"SELECT rol_id FROM rbac_fa ".
1714 "WHERE parent = ".$ilDB->quote($a_ref_id,
'integer').
" ".
1717 while(
$row = $ilDB->fetchObject(
$res))
1719 $rol_id[] =
$row->rol_id;
1722 return $rol_id ? $rol_id : array();
1730 $query =
"SELECT protected FROM rbac_fa ".
1731 "WHERE rol_id = ".$ilDB->quote($a_role_id,
'integer').
" ".
1732 "AND parent = ".$ilDB->quote($a_ref_id,
'integer').
" ";
1743 global $rbacsystem,$ilUser,
$log;
1745 if (in_array(SYSTEM_ROLE_ID,$this->
assignedRoles($ilUser->getId())))
1751 $leveladmin =
false;
1756 foreach ($a_role_hierarchy as $role_id => $rolf_id)
1762 if ($leveladmin ==
true)
1764 $a_parent_roles[$role_id][
'protected'] =
false;
1768 if ($a_parent_roles[$role_id][
'protected'] ==
true)
1770 $arr_lvl_roles_user = array_intersect($this->
assignedRoles($ilUser->getId()),array_keys($a_role_hierarchy,$rolf_id));
1772 foreach ($arr_lvl_roles_user as $lvl_role_id)
1779 if ($rbacsystem->checkPermission($a_ref_id,$lvl_role_id,
'edit_permission'))
1783 $a_parent_roles[$role_id][
'protected'] =
false;
1792 return $a_parent_roles;
1813 $query = sprintf(
'SELECT * FROM rbac_operations '.
1814 'JOIN rbac_ta ON rbac_operations.ops_id = rbac_ta.ops_id '.
1815 'JOIN object_data ON rbac_ta.typ_id = object_data.obj_id '.
1816 'WHERE object_data.title = %s '.
1817 'AND object_data.type = %s '.
1819 $ilDB->quote($a_type,
'text'),
1820 $ilDB->quote(
'typ',
'text'),
1821 $ilDB->quote(
'op_order',
'text'));
1825 $query =
'SELECT * FROM rbac_operations '.
1826 "ORDER BY 'op_order' ASC";
1829 while (
$row = $ilDB->fetchAssoc(
$res))
1832 "ops_id" =>
$row[
'ops_id'],
1833 "operation" =>
$row[
'operation'],
1834 "desc" =>
$row[
'description'],
1835 "class" =>
$row[
'class'],
1836 "order" =>
$row[
'op_order']
1846 foreach ($a_ops_arr as $ops)
1848 $arr[$ops[
'class']][] = array (
'ops_id' => $ops[
'ops_id'],
1849 'name' => $ops[
'operation']
1866 $query =
"SELECT obr.obj_id FROM rbac_fa rfa ".
1867 "JOIN tree ON rfa.parent = tree.child ".
1868 "JOIN object_reference obr ON tree.parent = obr.ref_id ".
1869 "WHERE tree.tree = 1 ".
1870 "AND assign = 'y' ".
1871 "AND rol_id = ".$ilDB->quote($a_role_id,
'integer').
" ";
1873 while(
$row = $ilDB->fetchObject(
$res))
1875 $obj_id =
$row->obj_id;
1878 return $obj_id ? $obj_id : 0;
1890 $query =
"SELECT tree.parent ref FROM rbac_fa fa ".
1891 "JOIN tree ON fa.parent = tree.child ".
1892 "WHERE tree.tree = 1 ".
1893 "AND assign = ".$ilDB->quote(
'y',
'text').
' '.
1894 "AND rol_id = ".$ilDB->quote($a_role_id,
'integer');
1913 if (count($rolf_list))
1915 foreach ($rolf_list as $rolf) {
1932 $role_list = array();
1936 $query =
"SELECT * FROM object_data ".
1937 "JOIN rbac_fa ON object_data.obj_id = rbac_fa.rol_id ".
1939 "AND rbac_fa.assign = 'y' " .
1940 'AND '.$ilDB->in(
'object_data.obj_id',$role_ids,
false,
'integer');
1943 while(
$row = $ilDB->fetchAssoc(
$res))
1945 $row[
"desc"] =
$row[
"description"];
1947 $role_list[] =
$row;
1962 $query =
'SELECT ta.typ_id, obj.title, ops.ops_id, ops.operation FROM rbac_ta ta '.
1963 'JOIN object_data obj ON obj.obj_id = ta.typ_id '.
1964 'JOIN rbac_operations ops ON ops.ops_id = ta.ops_id ';
1968 while(
$row = $ilDB->fetchObject(
$res))
1970 $info[$counter][
'typ_id'] =
$row->typ_id;
1971 $info[$counter][
'type'] =
$row->title;
1972 $info[$counter][
'ops_id'] =
$row->ops_id;
1973 $info[$counter][
'operation'] =
$row->operation;
1976 return $info ? $info : array();
1992 $query =
'SELECT DISTINCT(parent) parent FROM rbac_fa '.
1993 'WHERE '.$ilDB->in(
'parent',$a_rolf_candidates,
false,
'integer');
1995 while(
$row = $ilDB->fetchObject(
$res))
1997 $non_empty[] =
$row->parent;
1999 return $non_empty ? $non_empty : array();