29 (isset($ilDB)) ? $this->
ilDB =&$ilDB : $this->
ilDB =&$ilias->db;
50 $query =
'UPDATE rbac_fa set blocked = ' . $ilDB->quote($a_blocked_status,
'integer') .
' ' .
51 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer') .
' ' .
52 'AND parent = ' . $ilDB->quote($a_ref_id,
'integer');
67 if (!isset($a_usr_id)) {
68 $message = get_class($this) .
"::removeUser(): No usr_id given!";
69 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
72 $query =
"DELETE FROM rbac_ua WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer');
89 if (!isset($a_rol_id) or !isset($a_ref_id)) {
90 $message = get_class($this) .
"::deleteRole(): Missing parameter! role_id: " . $a_rol_id .
" ref_id of role folder: " . $a_ref_id;
91 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
95 if ($a_rol_id == SYSTEM_ROLE_ID) {
96 $this->ilErr->raiseError($lng->txt(
"msg_sysrole_not_deletable"), $this->ilErr->MESSAGE);
99 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
101 $mapping->deleteRole($a_rol_id);
108 $query =
"DELETE FROM rbac_ua " .
109 "WHERE rol_id = " . $ilDB->quote($a_rol_id,
'integer');
113 $query =
"DELETE FROM rbac_pa " .
114 "WHERE rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" ";
133 if (!isset($a_obj_id)) {
134 $message = get_class($this) .
"::deleteTemplate(): No obj_id given!";
135 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
138 $query =
'DELETE FROM rbac_templates ' .
139 'WHERE rol_id = ' . $ilDB->quote($a_obj_id,
'integer');
142 $query =
'DELETE FROM rbac_fa ' .
143 'WHERE rol_id = ' . $ilDB->quote($a_obj_id,
'integer');
160 if (!isset($a_rol_id)) {
161 $message = get_class($this) .
"::deleteLocalRole(): Missing parameter! role_id: '" . $a_rol_id .
"'";
162 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
166 if ($a_rol_id == SYSTEM_ROLE_ID) {
170 if ($a_ref_id != 0) {
171 $clause =
'AND parent = ' . $ilDB->quote($a_ref_id,
'integer') .
' ';
174 $query =
'DELETE FROM rbac_fa ' .
175 'WHERE rol_id = ' . $ilDB->quote($a_rol_id,
'integer') .
' ' .
179 $query =
'DELETE FROM rbac_templates ' .
180 'WHERE rol_id = ' . $ilDB->quote($a_rol_id,
'integer') .
' ' .
196 $ilAtomQuery = $ilDB->buildAtomQuery();
197 $ilAtomQuery->addTableLock(
'rbac_ua');
199 $ilAtomQuery->addQueryCallable(
200 function (
ilDBInterface $ilDB) use (&
$ret, $a_role_id, $a_usr_id,$a_limit, $a_limited_roles) {
202 $limit_query =
'SELECT COUNT(*) num FROM rbac_ua ' .
203 'WHERE ' . $ilDB->
in(
'rol_id', (
array) $a_limited_roles,
false,
'integer');
206 if (
$row->num >= $a_limit) {
211 $query =
"INSERT INTO rbac_ua (usr_id, rol_id) " .
213 $ilDB->
quote($a_usr_id,
'integer') .
"," . $ilDB->
quote($a_role_id,
'integer') .
225 $GLOBALS[
'rbacreview']->setAssignedCacheEntry($a_role_id, $a_usr_id,
true);
229 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
231 $mapping->assign($a_role_id, $a_usr_id);
242 include_once
'Services/AccessControl/classes/class.ilRoleDesktopItem.php';
244 foreach ($role_desk_item_obj->getAll() as $item_data) {
245 include_once
'./Services/User/classes/class.ilObjUser.php';
261 global
$ilDB,$rbacreview;
263 if (!isset($a_rol_id) or !isset($a_usr_id)) {
264 $message = get_class($this) .
"::assignUser(): Missing parameter! role_id: " . $a_rol_id .
" usr_id: " . $a_usr_id;
265 #$this->ilErr->raiseError($message,$this->ilErr->WARNING); 269 $alreadyAssigned = $rbacreview->isAssigned($a_usr_id, $a_rol_id);
272 if (!$alreadyAssigned) {
273 $query =
"INSERT INTO rbac_ua (usr_id, rol_id) " .
274 "VALUES (" . $ilDB->quote($a_usr_id,
'integer') .
"," . $ilDB->quote($a_rol_id,
'integer') .
")";
279 $rbacreview->setAssignedCacheEntry($a_rol_id, $a_usr_id,
true);
282 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
284 $mapping->assign($a_rol_id, $a_usr_id);
287 $ref_id =
$GLOBALS[
'rbacreview']->getObjectReferenceOfRole($a_rol_id);
291 if (!$alreadyAssigned) {
293 $GLOBALS[
'ilAppEventHandler']->raise(
294 'Services/AccessControl',
298 'usr_id' => $a_usr_id,
299 'role_id' => $a_rol_id,
318 global
$ilDB, $rbacreview;
320 if (!isset($a_rol_id) or !isset($a_usr_id)) {
321 $message = get_class($this) .
"::deassignUser(): Missing parameter! role_id: " . $a_rol_id .
" usr_id: " . $a_usr_id;
322 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
325 $query =
"DELETE FROM rbac_ua " .
326 "WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer') .
" " .
327 "AND rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" ";
330 $rbacreview->setAssignedCacheEntry($a_rol_id, $a_usr_id,
false);
332 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
334 $mapping->deassign($a_rol_id, $a_usr_id);
337 $ref_id =
$GLOBALS[
'rbacreview']->getObjectReferenceOfRole($a_rol_id);
342 $GLOBALS[
'ilAppEventHandler']->raise(
'Services/AccessControl',
'deassignUser',
array(
344 'usr_id' => $a_usr_id,
345 'role_id' => $a_rol_id,
365 if (!isset($a_rol_id) or !isset($a_ops) or !isset($a_ref_id)) {
366 $this->ilErr->raiseError(get_class($this) .
"::grantPermission(): Missing parameter! " .
367 "role_id: " . $a_rol_id .
" ref_id: " . $a_ref_id .
" operations: ", $this->ilErr->WARNING);
370 if (!is_array($a_ops)) {
371 $this->ilErr->raiseError(
372 get_class($this) .
"::grantPermission(): Wrong datatype for operations!",
373 $this->ilErr->WARNING
384 if ($a_rol_id == SYSTEM_ROLE_ID) {
389 foreach ($a_ops as
$key => $operation) {
390 $a_ops[
$key] = (int) $operation;
394 $ops_ids = serialize($a_ops);
396 $query =
'DELETE FROM rbac_pa ' .
397 'WHERE rol_id = %s ' .
399 $res = $ilDB->queryF(
401 array(
'integer',
'integer'),
402 array($a_rol_id,$a_ref_id)
405 if (!count($a_ops)) {
409 $query =
"INSERT INTO rbac_pa (rol_id,ops_id,ref_id) " .
411 "(" . $ilDB->quote($a_rol_id,
'integer') .
"," . $ilDB->quote($ops_ids,
'text') .
"," . $ilDB->quote($a_ref_id,
'integer') .
")";
430 if (!isset($a_ref_id)) {
432 $message = get_class($this) .
"::revokePermission(): Missing parameter! ref_id: " . $a_ref_id;
433 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
435 #$log->write("ilRBACadmin::revokePermission(), 0"); 438 if ($a_keep_protected !=
true) {
440 if ($a_rol_id == SYSTEM_ROLE_ID) {
445 $and1 =
" AND rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" ";
450 $query =
"DELETE FROM rbac_pa " .
451 "WHERE ref_id = " . $ilDB->quote($a_ref_id,
'integer') .
462 $roles_in_scope = $rbacreview->getParentRoleIds($a_ref_id);
465 #$log->write("ilRBACadmin::revokePermission(), 1"); 469 foreach ($roles_in_scope as $role) {
470 if ($role[
'protected'] ==
true) {
474 $role_ids[] = $role[
'obj_id'];
482 $query =
'DELETE FROM rbac_pa ' .
483 'WHERE ' . $ilDB->in(
'rol_id', $role_ids,
false,
'integer') .
' ' .
484 'AND ref_id = ' . $ilDB->quote($a_ref_id,
'integer');
487 #$log->write("ilRBACadmin::revokePermission(), 2"); 489 if ($a_rol_id == SYSTEM_ROLE_ID) {
494 if ($roles_in_scope[$a_rol_id][
'protected'] ==
true) {
498 $query =
"DELETE FROM rbac_pa " .
499 "WHERE ref_id = " . $ilDB->quote($a_ref_id,
'integer') .
" " .
500 "AND rol_id = " . $ilDB->quote($a_rol_id,
'integer') .
" ";
517 $query =
'DELETE FROM rbac_pa ' .
519 '( ' .
$GLOBALS[
'tree']->getSubTreeQuery($a_ref_id,
array(
'child')) .
' ) ' .
520 'AND rol_id = ' . $ilDB->quote($a_role_id,
'integer');
522 $ilDB->manipulate(
$query);
536 $query =
'DELETE FROM rbac_templates ' .
537 'WHERE parent IN ( ' .
538 $GLOBALS[
'tree']->getSubTreeQuery($a_ref_id,
array(
'child')) .
' ) ' .
539 'AND rol_id = ' . $ilDB->quote($a_rol_id,
'integer');
541 $ilDB->manipulate(
$query);
543 $query =
'DELETE FROM rbac_fa ' .
544 'WHERE parent IN ( ' .
545 $GLOBALS[
'tree']->getSubTreeQuery($a_ref_id,
array(
'child')) .
' ) ' .
546 'AND rol_id = ' . $ilDB->quote($a_rol_id,
'integer');
548 $ilDB->manipulate(
$query);
564 if (!isset($a_ref_ids) or !is_array($a_ref_ids)) {
565 $message = get_class($this) .
"::revokePermissionList(): Missing parameter or parameter is not an array! reference_list: " . var_dump($a_ref_ids);
566 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
569 if (!isset($a_rol_id)) {
570 $message = get_class($this) .
"::revokePermissionList(): Missing parameter! rol_id: " . $a_rol_id;
571 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
575 if ($a_rol_id == SYSTEM_ROLE_ID) {
579 $query =
"DELETE FROM rbac_pa " .
580 "WHERE " . $ilDB->in(
'ref_id', $a_ref_ids,
false,
'integer') .
' ' .
581 "AND rol_id = " . $ilDB->quote($a_rol_id,
'integer');
597 public function copyRolePermissions($a_source_id, $a_source_parent, $a_dest_parent, $a_dest_id, $a_consider_protected =
true)
599 global $tree,$rbacreview;
604 $ops = $rbacreview->getRoleOperationsOnObject($a_source_id, $a_source_parent);
623 global $rbacreview,
$ilDB;
625 if (!isset($a_source_id) or !isset($a_source_parent) or !isset($a_dest_id) or !isset($a_dest_parent)) {
626 $message = __METHOD__ .
": Missing parameter! source_id: " . $a_source_id .
627 " source_parent_id: " . $a_source_parent .
628 " dest_id : " . $a_dest_id .
629 " dest_parent_id: " . $a_dest_parent;
630 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
634 if ($a_dest_id == SYSTEM_ROLE_ID) {
639 $query =
'SELECT * FROM rbac_templates ' .
640 'WHERE rol_id = ' . $ilDB->quote($a_source_id,
'integer') .
' ' .
641 'AND parent = ' . $ilDB->quote($a_source_parent,
'integer');
643 $operations =
array();
645 while (
$row = $ilDB->fetchObject(
$res)) {
646 $operations[$rownum][
'type'] =
$row->type;
647 $operations[$rownum][
'ops_id'] =
$row->ops_id;
652 $query =
'DELETE FROM rbac_templates WHERE rol_id = ' . $ilDB->quote($a_dest_id,
'integer') .
' ' .
653 'AND parent = ' . $ilDB->quote($a_dest_parent,
'integer');
656 foreach ($operations as
$row => $op) {
657 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
659 $ilDB->quote($a_dest_id,
'integer') .
"," .
660 $ilDB->quote($op[
'type'],
'text') .
"," .
661 $ilDB->quote($op[
'ops_id'],
'integer') .
"," .
662 $ilDB->quote($a_dest_parent,
'integer') .
")";
663 $ilDB->manipulate(
$query);
667 if ($a_consider_protected ==
true) {
668 if ($rbacreview->isProtected($a_source_parent, $a_source_id)) {
690 global $rbacreview,
$ilDB;
692 if (!isset($a_source1_id) or !isset($a_source1_parent)
693 or !isset($a_source2_id) or !isset($a_source2_parent)
694 or !isset($a_dest_id) or !isset($a_dest_parent)) {
695 $message = get_class($this) .
"::copyRolePermissionIntersection(): Missing parameter! source1_id: " . $a_source1_id .
696 " source1_parent: " . $a_source1_parent .
697 " source2_id: " . $a_source2_id .
698 " source2_parent: " . $a_source2_parent .
699 " dest_id: " . $a_dest_id .
700 " dest_parent_id: " . $a_dest_parent;
701 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
705 if ($a_dest_id == SYSTEM_ROLE_ID) {
710 if ($rbacreview->isProtected($a_source2_parent, $a_source2_id)) {
711 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Role is protected');
715 $query =
"SELECT s1.type, s1.ops_id " .
716 "FROM rbac_templates s1, rbac_templates s2 " .
717 "WHERE s1.rol_id = " . $ilDB->quote($a_source1_id,
'integer') .
" " .
718 "AND s1.parent = " . $ilDB->quote($a_source1_parent,
'integer') .
" " .
719 "AND s2.rol_id = " . $ilDB->quote($a_source2_id,
'integer') .
" " .
720 "AND s2.parent = " . $ilDB->quote($a_source2_parent,
'integer') .
" " .
721 "AND s1.type = s2.type " .
722 "AND s1.ops_id = s2.ops_id";
727 $operations =
array();
730 $operations[$rowNum][
'type'] =
$row->type;
731 $operations[$rowNum][
'ops_id'] =
$row->ops_id;
737 $query =
'DELETE FROM rbac_templates WHERE rol_id = ' . $ilDB->quote($a_dest_id,
'integer') .
' ' .
738 'AND parent = ' . $ilDB->quote($a_dest_parent,
'integer');
741 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
743 $sta = $ilDB->prepareManip(
$query,
array(
'integer',
'text',
'integer',
'integer'));
744 foreach ($operations as
$key => $set) {
745 $ilDB->execute($sta,
array(
773 global
$ilDB, $rbacreview;
776 $s1_ops = $rbacreview->getAllOperationsOfRole($a_source1_id, $a_source1_parent);
777 $s2_ops = $rbacreview->getAlloperationsOfRole($a_source2_id, $a_source2_parent);
781 $GLOBALS[
'ilLog']->write(__METHOD__ .
': ' . print_r($s1_ops,
true));
782 $GLOBALS[
'ilLog']->write(__METHOD__ .
': ' . print_r($s2_ops,
true));
784 foreach ($s1_ops as
$type => $ops) {
785 foreach ($ops as $op) {
788 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
790 $ilDB->quote($a_dest_id,
'integer') .
', ' .
791 $ilDB->quote(
$type,
'text') .
', ' .
792 $ilDB->quote($op,
'integer') .
', ' .
793 $ilDB->quote($a_dest_parent,
'integer') .
' ' .
795 $ilDB->manipulate(
$query);
800 foreach ($s2_ops as
$type => $ops) {
801 foreach ($ops as $op) {
802 if (!isset($s1_ops[
$type]) or !in_array($op, $s1_ops[$type])) {
803 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
805 $ilDB->quote($a_dest_id,
'integer') .
', ' .
806 $ilDB->quote($type,
'text') .
', ' .
807 $ilDB->quote($op,
'integer') .
', ' .
808 $ilDB->quote($a_dest_parent,
'integer') .
' ' .
810 $ilDB->manipulate(
$query);
827 global $rbacreview,
$ilDB;
829 $s1_ops = $rbacreview->getAllOperationsOfRole($a_source_id, $a_source_parent);
830 $d_ops = $rbacreview->getAllOperationsOfRole($a_dest_id, $a_dest_parent);
832 foreach ($s1_ops as
$type => $ops) {
833 foreach ($ops as $op) {
834 if (isset($d_ops[
$type]) and in_array($op, $d_ops[$type])) {
835 $query =
'DELETE FROM rbac_templates ' .
836 'WHERE rol_id = ' . $ilDB->quote($a_dest_id,
'integer') .
' ' .
837 'AND type = ' . $ilDB->quote($type,
'text') .
' ' .
838 'AND ops_id = ' . $ilDB->quote($op,
'integer') .
' ' .
839 'AND parent = ' . $ilDB->quote($a_dest_parent,
'integer');
840 $ilDB->manipulate(
$query);
862 if (!isset($a_rol_id) or !isset($a_ref_id)) {
863 $message = get_class($this) .
"::deleteRolePermission(): Missing parameter! role_id: " . $a_rol_id .
" ref_id: " . $a_ref_id;
864 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
868 if ($a_rol_id == SYSTEM_ROLE_ID) {
873 $and_type =
" AND type=" . $ilDB->quote(
$a_type,
'text') .
" ";
876 $query =
'DELETE FROM rbac_templates ' .
877 'WHERE rol_id = ' . $ilDB->quote($a_rol_id,
'integer') .
' ' .
878 'AND parent = ' . $ilDB->quote($a_ref_id,
'integer') .
' ' .
900 if (!isset($a_rol_id) or !isset(
$a_type) or !isset($a_ops) or !isset($a_ref_id)) {
901 $message = get_class($this) .
"::setRolePermission(): Missing parameter!" .
902 " role_id: " . $a_rol_id .
904 " operations: " . $a_ops .
905 " ref_id: " . $a_ref_id;
906 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
910 $message = get_class($this) .
"::setRolePermission(): a_type is no string or empty!";
911 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
914 if (!is_array($a_ops) or empty($a_ops)) {
915 $message = get_class($this) .
"::setRolePermission(): a_ops is no array or empty!";
916 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
920 if ($a_rol_id == SYSTEM_ROLE_ID) {
924 foreach ($a_ops as $op) {
928 'rol_id' => [
'integer', $a_rol_id],
930 'ops_id' => [
'integer', $op],
931 'parent' => [
'integer', $a_ref_id]
954 global
$ilDB,$rbacreview;
956 if (!isset($a_rol_id) or !isset($a_parent)) {
957 $message = get_class($this) .
"::assignRoleToFolder(): Missing Parameter!" .
958 " role_id: " . $a_rol_id .
959 " parent_id: " . $a_parent .
960 " assign: " . $a_assign;
961 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
965 if ($a_rol_id == SYSTEM_ROLE_ID) {
970 if ($a_assign !=
"y") {
975 $query =
'SELECT rol_id FROM rbac_fa ' .
976 'WHERE rol_id = ' . $ilDB->quote($a_rol_id,
'integer') .
' ' .
977 'AND parent = ' . $ilDB->quote($a_parent,
'integer');
979 if (
$res->numRows()) {
985 'INSERT INTO rbac_fa (rol_id, parent, assign, protected) ' .
986 'VALUES (%s,%s,%s,%s)',
987 $ilDB->quote($a_rol_id,
'integer'),
988 $ilDB->quote($a_parent,
'integer'),
989 $ilDB->quote($a_assign,
'text'),
990 $ilDB->quote(
'n',
'text')
1009 if (!isset($a_type_id) or !isset($a_ops_id)) {
1010 $message = get_class($this) .
"::assignOperationToObject(): Missing parameter!" .
1011 "type_id: " . $a_type_id .
1012 "ops_id: " . $a_ops_id;
1013 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
1016 $query =
"INSERT INTO rbac_ta (typ_id, ops_id) " .
1017 "VALUES(" . $ilDB->quote($a_type_id,
'integer') .
"," . $ilDB->quote($a_ops_id,
'integer') .
")";
1034 if (!isset($a_type_id) or !isset($a_ops_id)) {
1035 $message = get_class($this) .
"::deassignPermissionFromObject(): Missing parameter!" .
1036 "type_id: " . $a_type_id .
1037 "ops_id: " . $a_ops_id;
1038 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
1041 $query =
"DELETE FROM rbac_ta " .
1042 "WHERE typ_id = " . $ilDB->quote($a_type_id,
'integer') .
" " .
1043 "AND ops_id = " . $ilDB->quote($a_ops_id,
'integer');
1063 $query =
'UPDATE rbac_fa ' .
1064 'SET protected = ' . $ilDB->quote($a_value,
'text') .
' ' .
1065 'WHERE rol_id = ' . $ilDB->quote($a_role_id,
'integer');
1082 global $rbacreview,
$ilLog,$ilObjDataCache;
1084 $real_local =
array();
1085 foreach ($rbacreview->getRolesOfRoleFolder($a_source_id,
false) as $role_data) {
1086 $title = $ilObjDataCache->lookupTitle($role_data);
1087 if (substr(
$title, 0, 3) ==
'il_') {
1090 $real_local[] = $role_data;
1092 if (!count($real_local)) {
1096 foreach ($real_local as $role) {
1097 include_once(
"./Services/AccessControl/classes/class.ilObjRole.php");
1101 $ilLog->write(__METHOD__ .
': Start copying of role ' .
$orig->getTitle());
1103 $roleObj->setTitle(
$orig->getTitle());
1104 $roleObj->setDescription(
$orig->getDescription());
1105 $roleObj->setImportId(
$orig->getImportId());
1110 $ilLog->write(__METHOD__ .
': Added new local role, id ' . $roleObj->getId());
1128 if ($rbacreview->isProtected($a_role_parent, $a_role_id)) {
1130 $new_ops = $rbacreview->getOperationsOfRole(
1144 if (!$a_template_id) {
1166 $new_ops = $rbacreview->getOperationsOfRole(
1194 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1199 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
1204 $action->setRefId($a_ref_id);
1224 global $rbacreview,$tree,
$ilLog;
1226 $new_parent = $tree->getParentId($a_ref_id);
1227 $old_context_roles = $rbacreview->getParentRoleIds($a_old_parent,
false);
1228 $new_context_roles = $rbacreview->getParentRoleIds($new_parent,
false);
1230 $for_addition = $for_deletion =
array();
1231 foreach ($new_context_roles as $new_role_id => $new_role) {
1232 if (!isset($old_context_roles[$new_role_id])) {
1233 $for_addition[$new_role_id] = $new_role;
1234 } elseif ($new_role[
'parent'] != $old_context_roles[$new_role_id][
'parent']) {
1236 $for_deletion[$new_role_id] = $new_role;
1237 $for_addition[$new_role_id] = $new_role;
1240 foreach ($old_context_roles as $old_role_id => $old_role) {
1241 if (!isset($new_context_roles[$old_role_id])) {
1242 $for_deletion[$old_role_id] = $old_role;
1246 if (!count($for_deletion) and !count($for_addition)) {
1251 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1253 if ($rbac_log_active) {
1254 $role_ids = array_unique(array_merge(array_keys($for_deletion), array_keys($for_addition)));
1257 foreach ($nodes = $tree->getSubTree($tree->getNodeData($a_ref_id),
true) as $node_data) {
1258 $node_id = $node_data[
'child'];
1260 if ($rbac_log_active) {
1267 if (!$node_data[
'type']) {
1268 $ilLog->write(__METHOD__ .
': No type give. Choosing next tree entry.');
1273 $ilLog->write(__METHOD__ .
': Missing subtree node_id');
1277 foreach ($for_deletion as $role_id => $role_data) {
1282 foreach ($for_addition as $role_id => $role_data) {
1283 switch ($node_data[
'type']) {
1285 include_once
'./Modules/Group/classes/class.ilObjGroup.php';
1288 $node_data[
'child'],
1290 $role_data[
'parent'],
1297 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
1300 $node_data[
'child'],
1302 $role_data[
'parent'],
1312 $ops = $rbacreview->getOperationsOfRole($role_id, $node_data[
'type'], $role_data[
'parent']),
1324 if ($rbac_log_active) {
static lookupTemplateId($a_ref_id)
Lookup template id ilDB $ilDB.
static lookupGroupStatusTemplateId($a_obj_id)
$ilDB $ilDB
applyMovedObjectDidacticTemplates($a_ref_id, $a_old_parent)
Apply didactic templates after object movement.
removeUser($a_usr_id)
deletes a user from rbac_ua all user <-> role relations are deleted public
deleteRolePermission($a_rol_id, $a_ref_id, $a_type=false)
Deletes all entries of a template.
const PEAR_ERROR_CALLBACK
deassignOperationFromObject($a_type_id, $a_ops_id)
Deassign an existing operation from an object Update of rbac_ta public.
static lookupCourseNonMemberTemplatesId()
Lookup course non member id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
revokeSubtreePermissions($a_ref_id, $a_role_id)
Revoke subtree permissions.
setBlockedStatus($a_role_id, $a_ref_id, $a_blocked_status)
Set blocked status.
adjustMovedObjectPermissions($a_ref_id, $a_old_parent)
Adjust permissions of moved objects.
in($field, $values, $negate=false, $type="")
copyRolePermissionUnion( $a_source1_id, $a_source1_parent, $a_source2_id, $a_source2_parent, $a_dest_id, $a_dest_parent)
<type> $ilDB
deleteSubtreeTemplates($a_ref_id, $a_rol_id)
Delete all template permissions of subtree nodes.
assignUser($a_rol_id, $a_usr_id)
Assigns an user to a role.
setRolePermission($a_rol_id, $a_type, $a_ops, $a_ref_id)
Inserts template permissions in rbac_templates for an specific object type.
copyRoleTemplatePermissions($a_source_id, $a_source_parent, $a_dest_parent, $a_dest_id, $a_consider_protected=true)
Copies template permissions of one role to another.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static diffFaPa(array $a_old, array $a_new)
deassignUser($a_rol_id, $a_usr_id)
Deassigns a user from a role.
deleteLocalRole($a_rol_id, $a_ref_id=0)
Deletes a local role and entries in rbac_fa and rbac_templates public.
static _getInstance()
Get singleton instance of this class.
initIntersectionPermissions($a_ref_id, $a_role_id, $a_role_parent, $a_template_id, $a_template_parent)
Init intersection permissions.
catch(Exception $e) $message
assignUserLimited($a_role_id, $a_usr_id, $a_limit, $a_limited_roles=array())
Assign user limited.
foreach($_POST as $key=> $value) $res
addDesktopItem($a_rol_id, $a_usr_id)
Add desktop item.
setProtected($a_ref_id, $a_role_id, $a_value)
Set protected $ilDB.
copyLocalRoles($a_source_id, $a_target_id)
Copy local roles This method creates a copy of all local role.
static _lookupObjId($a_id)
copyRolePermissionIntersection($a_source1_id, $a_source1_parent, $a_source2_id, $a_source2_parent, $a_dest_parent, $a_dest_id)
Copies the intersection of the template permissions of two roles to a third role. ...
grantPermission($a_rol_id, $a_ops, $a_ref_id)
Grants a permission to an object and a specific role.
revokePermissionList($a_ref_ids, $a_rol_id)
Revokes permissions of a LIST of objects of ONE role.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
copyRolePermissionSubtract($a_source_id, $a_source_parent, $a_dest_id, $a_dest_parent)
Subtract role permissions.
__construct()
Constructor public.
copyRolePermissions($a_source_id, $a_source_parent, $a_dest_parent, $a_dest_id, $a_consider_protected=true)
Copies template permissions and permission of one role to another.
deleteRole($a_rol_id, $a_ref_id)
Deletes a role and deletes entries in object_data, rbac_pa, rbac_templates, rbac_ua, rbac_fa public.
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
represents a creation of local roles action
assignOperationToObject($a_type_id, $a_ops_id)
Assign an existing operation to an object Update of rbac_ta.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
revokePermission($a_ref_id, $a_rol_id=0, $a_keep_protected=true)
Revokes permissions of an object of one role.
query($query)
Run a (read-only) Query on the database.
deleteTemplate($a_obj_id)
Deletes a template from role folder and deletes all entries in rbac_templates, rbac_fa public...
static getLogger($a_component_id)
Get component logger.
Class ilRbacAdmin Core functions for role based access control.
manipulate($query)
Run a (write) Query on the database.
assignRoleToFolder($a_rol_id, $a_parent, $a_assign="y")
Assigns a role to an role folder A role folder is an object to store roles.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.