30 $ilias = $DIC[
'ilias'];
33 (isset(
$ilDB)) ? $this->ilDB = &
$ilDB : $this->ilDB = &$ilias->db;
56 $query =
'UPDATE rbac_fa set blocked = ' .
$ilDB->quote($a_blocked_status,
'integer') .
' ' .
57 'WHERE rol_id = ' .
$ilDB->quote($a_role_id,
'integer') .
' ' .
58 'AND parent = ' .
$ilDB->quote($a_ref_id,
'integer');
73 $ilDB = $DIC->database();
74 $review = $DIC->rbac()->review();
76 if (!isset($a_usr_id)) {
77 $message = get_class($this) .
"::removeUser(): No usr_id given!";
78 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
81 foreach ($review->assignedRoles($a_usr_id) as $role_id) {
85 $query =
"DELETE FROM rbac_ua WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer');
103 $ilDB = $DIC[
'ilDB'];
105 if (!isset($a_rol_id) or !isset($a_ref_id)) {
106 $message = get_class($this) .
"::deleteRole(): Missing parameter! role_id: " . $a_rol_id .
" ref_id of role folder: " . $a_ref_id;
107 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
111 if ($a_rol_id == SYSTEM_ROLE_ID) {
112 $this->ilErr->raiseError(
$lng->txt(
"msg_sysrole_not_deletable"), $this->ilErr->MESSAGE);
115 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
117 $mapping->deleteRole($a_rol_id);
124 $query =
"DELETE FROM rbac_ua " .
125 "WHERE rol_id = " .
$ilDB->quote($a_rol_id,
'integer');
129 $query =
"DELETE FROM rbac_pa " .
130 "WHERE rol_id = " .
$ilDB->quote($a_rol_id,
'integer') .
" ";
149 $ilDB = $DIC[
'ilDB'];
151 if (!isset($a_obj_id)) {
152 $message = get_class($this) .
"::deleteTemplate(): No obj_id given!";
153 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
156 $query =
'DELETE FROM rbac_templates ' .
157 'WHERE rol_id = ' .
$ilDB->quote($a_obj_id,
'integer');
160 $query =
'DELETE FROM rbac_fa ' .
161 'WHERE rol_id = ' .
$ilDB->quote($a_obj_id,
'integer');
178 $ilDB = $DIC[
'ilDB'];
180 if (!isset($a_rol_id)) {
181 $message = get_class($this) .
"::deleteLocalRole(): Missing parameter! role_id: '" . $a_rol_id .
"'";
182 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
186 if ($a_rol_id == SYSTEM_ROLE_ID) {
190 if ($a_ref_id != 0) {
191 $clause =
'AND parent = ' .
$ilDB->quote($a_ref_id,
'integer') .
' ';
194 $query =
'DELETE FROM rbac_fa ' .
195 'WHERE rol_id = ' .
$ilDB->quote($a_rol_id,
'integer') .
' ' .
199 $query =
'DELETE FROM rbac_templates ' .
200 'WHERE rol_id = ' .
$ilDB->quote($a_rol_id,
'integer') .
' ' .
216 $ilDB = $DIC[
'ilDB'];
218 $ilAtomQuery =
$ilDB->buildAtomQuery();
219 $ilAtomQuery->addTableLock(
'rbac_ua');
221 $ilAtomQuery->addQueryCallable(
224 $limit_query =
'SELECT COUNT(*) num FROM rbac_ua ' .
225 'WHERE ' . $ilDB->
in(
'rol_id', (array) $a_limited_roles,
false,
'integer');
228 if ($row->num >= $a_limit) {
233 $query =
"INSERT INTO rbac_ua (usr_id, rol_id) " .
235 $ilDB->
quote($a_usr_id,
'integer') .
"," . $ilDB->
quote($a_role_id,
'integer') .
247 $GLOBALS[
'DIC'][
'rbacreview']->setAssignedCacheEntry($a_role_id, $a_usr_id,
true);
249 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
251 $mapping->assign($a_role_id, $a_usr_id);
268 $ilDB = $DIC[
'ilDB'];
269 $rbacreview = $DIC[
'rbacreview'];
271 if (!isset($a_rol_id) or !isset($a_usr_id)) {
272 $message = get_class($this) .
"::assignUser(): Missing parameter! role_id: " . $a_rol_id .
" usr_id: " . $a_usr_id;
273 #$this->ilErr->raiseError($message,$this->ilErr->WARNING); 277 $alreadyAssigned = $rbacreview->isAssigned($a_usr_id, $a_rol_id);
280 if (!$alreadyAssigned) {
281 $query =
"INSERT INTO rbac_ua (usr_id, rol_id) " .
282 "VALUES (" .
$ilDB->quote($a_usr_id,
'integer') .
"," .
$ilDB->quote($a_rol_id,
'integer') .
")";
285 $rbacreview->setAssignedCacheEntry($a_rol_id, $a_usr_id,
true);
288 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
290 $mapping->assign($a_rol_id, $a_usr_id);
293 $ref_id =
$GLOBALS[
'DIC'][
'rbacreview']->getObjectReferenceOfRole($a_rol_id);
297 if (!$alreadyAssigned) {
299 $GLOBALS[
'DIC'][
'ilAppEventHandler']->raise(
300 'Services/AccessControl',
304 'usr_id' => $a_usr_id,
305 'role_id' => $a_rol_id,
326 $ilDB = $DIC[
'ilDB'];
327 $rbacreview = $DIC->rbac()->review();
329 if (!isset($a_rol_id) or !isset($a_usr_id)) {
330 $message = get_class($this) .
"::deassignUser(): Missing parameter! role_id: " . $a_rol_id .
" usr_id: " . $a_usr_id;
331 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
334 $query =
"DELETE FROM rbac_ua " .
335 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
336 "AND rol_id = " .
$ilDB->quote($a_rol_id,
'integer') .
" ";
339 $rbacreview->setAssignedCacheEntry($a_rol_id, $a_usr_id,
false);
341 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
343 $mapping->deassign($a_rol_id, $a_usr_id);
346 $ref_id =
$GLOBALS[
'DIC'][
'rbacreview']->getObjectReferenceOfRole($a_rol_id);
351 $GLOBALS[
'DIC'][
'ilAppEventHandler']->raise(
'Services/AccessControl',
'deassignUser', array(
353 'usr_id' => $a_usr_id,
354 'role_id' => $a_rol_id,
374 $ilDB = $DIC[
'ilDB'];
376 if (!isset($a_rol_id) or !isset($a_ops) or !isset($a_ref_id)) {
377 $this->ilErr->raiseError(get_class($this) .
"::grantPermission(): Missing parameter! " .
378 "role_id: " . $a_rol_id .
" ref_id: " . $a_ref_id .
" operations: ", $this->ilErr->WARNING);
381 if (!is_array($a_ops)) {
382 $this->ilErr->raiseError(
383 get_class($this) .
"::grantPermission(): Wrong datatype for operations!",
384 $this->ilErr->WARNING
395 if ($a_rol_id == SYSTEM_ROLE_ID) {
400 foreach ($a_ops as $key => $operation) {
401 $a_ops[$key] = (int) $operation;
405 $ops_ids = serialize($a_ops);
407 $query =
'DELETE FROM rbac_pa ' .
408 'WHERE rol_id = %s ' .
412 array(
'integer',
'integer'),
413 array($a_rol_id,$a_ref_id)
416 if (!count($a_ops)) {
420 $query =
"INSERT INTO rbac_pa (rol_id,ops_id,ref_id) " .
422 "(" .
$ilDB->quote($a_rol_id,
'integer') .
"," .
$ilDB->quote($ops_ids,
'text') .
"," .
$ilDB->quote($a_ref_id,
'integer') .
")";
441 $rbacreview = $DIC[
'rbacreview'];
443 $ilDB = $DIC[
'ilDB'];
446 if (!isset($a_ref_id)) {
448 $message = get_class($this) .
"::revokePermission(): Missing parameter! ref_id: " . $a_ref_id;
449 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
451 #$log->write("ilRBACadmin::revokePermission(), 0"); 454 if ($a_keep_protected !=
true) {
456 if ($a_rol_id == SYSTEM_ROLE_ID) {
461 $and1 =
" AND rol_id = " .
$ilDB->quote($a_rol_id,
'integer') .
" ";
466 $query =
"DELETE FROM rbac_pa " .
467 "WHERE ref_id = " .
$ilDB->quote($a_ref_id,
'integer') .
478 $roles_in_scope = $rbacreview->getParentRoleIds($a_ref_id);
481 #$log->write("ilRBACadmin::revokePermission(), 1"); 485 foreach ($roles_in_scope as $role) {
486 if ($role[
'protected'] ==
true) {
490 $role_ids[] = $role[
'obj_id'];
498 $query =
'DELETE FROM rbac_pa ' .
499 'WHERE ' .
$ilDB->in(
'rol_id', $role_ids,
false,
'integer') .
' ' .
500 'AND ref_id = ' .
$ilDB->quote($a_ref_id,
'integer');
503 #$log->write("ilRBACadmin::revokePermission(), 2"); 505 if ($a_rol_id == SYSTEM_ROLE_ID) {
510 if ($roles_in_scope[$a_rol_id][
'protected'] ==
true) {
514 $query =
"DELETE FROM rbac_pa " .
515 "WHERE ref_id = " .
$ilDB->quote($a_ref_id,
'integer') .
" " .
516 "AND rol_id = " .
$ilDB->quote($a_rol_id,
'integer') .
" ";
533 $ilDB = $DIC[
'ilDB'];
535 $query =
'DELETE FROM rbac_pa ' .
537 '( ' .
$GLOBALS[
'DIC'][
'tree']->getSubTreeQuery($a_ref_id, array(
'child')) .
' ) ' .
538 'AND rol_id = ' .
$ilDB->quote($a_role_id,
'integer');
554 $ilDB = $DIC[
'ilDB'];
556 $query =
'DELETE FROM rbac_templates ' .
557 'WHERE parent IN ( ' .
558 $GLOBALS[
'DIC'][
'tree']->getSubTreeQuery($a_ref_id, array(
'child')) .
' ) ' .
559 'AND rol_id = ' .
$ilDB->quote($a_rol_id,
'integer');
563 $query =
'DELETE FROM rbac_fa ' .
564 'WHERE parent IN ( ' .
565 $GLOBALS[
'DIC'][
'tree']->getSubTreeQuery($a_ref_id, array(
'child')) .
' ) ' .
566 'AND rol_id = ' .
$ilDB->quote($a_rol_id,
'integer');
584 $ilDB = $DIC[
'ilDB'];
586 if (!isset($a_ref_ids) or !is_array($a_ref_ids)) {
587 $message = get_class($this) .
"::revokePermissionList(): Missing parameter or parameter is not an array! reference_list: " . var_dump($a_ref_ids);
588 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
591 if (!isset($a_rol_id)) {
592 $message = get_class($this) .
"::revokePermissionList(): Missing parameter! rol_id: " . $a_rol_id;
593 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
597 if ($a_rol_id == SYSTEM_ROLE_ID) {
601 $query =
"DELETE FROM rbac_pa " .
602 "WHERE " .
$ilDB->in(
'ref_id', $a_ref_ids,
false,
'integer') .
' ' .
603 "AND rol_id = " .
$ilDB->quote($a_rol_id,
'integer');
619 public function copyRolePermissions($a_source_id, $a_source_parent, $a_dest_parent, $a_dest_id, $a_consider_protected =
true)
623 $tree = $DIC[
'tree'];
624 $rbacreview = $DIC[
'rbacreview'];
629 $ops = $rbacreview->getRoleOperationsOnObject($a_source_id, $a_source_parent);
650 $rbacreview = $DIC[
'rbacreview'];
651 $ilDB = $DIC[
'ilDB'];
653 if (!isset($a_source_id) or !isset($a_source_parent) or !isset($a_dest_id) or !isset($a_dest_parent)) {
654 $message = __METHOD__ .
": Missing parameter! source_id: " . $a_source_id .
655 " source_parent_id: " . $a_source_parent .
656 " dest_id : " . $a_dest_id .
657 " dest_parent_id: " . $a_dest_parent;
658 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
662 if ($a_dest_id == SYSTEM_ROLE_ID) {
667 $query =
'SELECT * FROM rbac_templates ' .
668 'WHERE rol_id = ' .
$ilDB->quote($a_source_id,
'integer') .
' ' .
669 'AND parent = ' .
$ilDB->quote($a_source_parent,
'integer');
671 $operations = array();
673 while ($row =
$ilDB->fetchObject(
$res)) {
674 $operations[$rownum][
'type'] = $row->type;
675 $operations[$rownum][
'ops_id'] = $row->ops_id;
680 $query =
'DELETE FROM rbac_templates WHERE rol_id = ' .
$ilDB->quote($a_dest_id,
'integer') .
' ' .
681 'AND parent = ' .
$ilDB->quote($a_dest_parent,
'integer');
684 foreach ($operations as $row => $op) {
685 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
687 $ilDB->quote($a_dest_id,
'integer') .
"," .
688 $ilDB->quote($op[
'type'],
'text') .
"," .
689 $ilDB->quote($op[
'ops_id'],
'integer') .
"," .
690 $ilDB->quote($a_dest_parent,
'integer') .
")";
695 if ($a_consider_protected ==
true) {
696 if ($rbacreview->isProtected($a_source_parent, $a_source_id)) {
720 $rbacreview = $DIC[
'rbacreview'];
721 $ilDB = $DIC[
'ilDB'];
723 if (!isset($a_source1_id) or !isset($a_source1_parent)
724 or !isset($a_source2_id) or !isset($a_source2_parent)
725 or !isset($a_dest_id) or !isset($a_dest_parent)) {
726 $message = get_class($this) .
"::copyRolePermissionIntersection(): Missing parameter! source1_id: " . $a_source1_id .
727 " source1_parent: " . $a_source1_parent .
728 " source2_id: " . $a_source2_id .
729 " source2_parent: " . $a_source2_parent .
730 " dest_id: " . $a_dest_id .
731 " dest_parent_id: " . $a_dest_parent;
732 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
736 if ($a_dest_id == SYSTEM_ROLE_ID) {
741 if ($rbacreview->isProtected($a_source2_parent, $a_source2_id)) {
742 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Role is protected');
746 $query =
"SELECT s1.type, s1.ops_id " .
747 "FROM rbac_templates s1, rbac_templates s2 " .
748 "WHERE s1.rol_id = " .
$ilDB->quote($a_source1_id,
'integer') .
" " .
749 "AND s1.parent = " .
$ilDB->quote($a_source1_parent,
'integer') .
" " .
750 "AND s2.rol_id = " .
$ilDB->quote($a_source2_id,
'integer') .
" " .
751 "AND s2.parent = " .
$ilDB->quote($a_source2_parent,
'integer') .
" " .
752 "AND s1.type = s2.type " .
753 "AND s1.ops_id = s2.ops_id";
758 $operations = array();
761 $operations[$rowNum][
'type'] = $row->type;
762 $operations[$rowNum][
'ops_id'] = $row->ops_id;
768 $query =
'DELETE FROM rbac_templates WHERE rol_id = ' .
$ilDB->quote($a_dest_id,
'integer') .
' ' .
769 'AND parent = ' .
$ilDB->quote($a_dest_parent,
'integer');
772 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
774 $sta =
$ilDB->prepareManip(
$query, array(
'integer',
'text',
'integer',
'integer'));
775 foreach ($operations as $key => $set) {
776 $ilDB->execute($sta, array(
806 $ilDB = $DIC[
'ilDB'];
807 $rbacreview = $DIC[
'rbacreview'];
810 $s1_ops = $rbacreview->getAllOperationsOfRole($a_source1_id, $a_source1_parent);
811 $s2_ops = $rbacreview->getAlloperationsOfRole($a_source2_id, $a_source2_parent);
815 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': ' . print_r($s1_ops,
true));
816 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': ' . print_r($s2_ops,
true));
818 foreach ($s1_ops as
$type => $ops) {
819 foreach ($ops as $op) {
822 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
824 $ilDB->quote($a_dest_id,
'integer') .
', ' .
826 $ilDB->quote($op,
'integer') .
', ' .
827 $ilDB->quote($a_dest_parent,
'integer') .
' ' .
834 foreach ($s2_ops as
$type => $ops) {
835 foreach ($ops as $op) {
836 if (!isset($s1_ops[
$type]) or !in_array($op, $s1_ops[$type])) {
837 $query =
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
839 $ilDB->quote($a_dest_id,
'integer') .
', ' .
840 $ilDB->quote($type,
'text') .
', ' .
841 $ilDB->quote($op,
'integer') .
', ' .
842 $ilDB->quote($a_dest_parent,
'integer') .
' ' .
863 $rbacreview = $DIC[
'rbacreview'];
864 $ilDB = $DIC[
'ilDB'];
866 $s1_ops = $rbacreview->getAllOperationsOfRole($a_source_id, $a_source_parent);
867 $d_ops = $rbacreview->getAllOperationsOfRole($a_dest_id, $a_dest_parent);
869 foreach ($s1_ops as
$type => $ops) {
870 foreach ($ops as $op) {
871 if (isset($d_ops[
$type]) and in_array($op, $d_ops[$type])) {
872 $query =
'DELETE FROM rbac_templates ' .
873 'WHERE rol_id = ' .
$ilDB->quote($a_dest_id,
'integer') .
' ' .
874 'AND type = ' .
$ilDB->quote($type,
'text') .
' ' .
875 'AND ops_id = ' .
$ilDB->quote($op,
'integer') .
' ' .
876 'AND parent = ' .
$ilDB->quote($a_dest_parent,
'integer');
899 $ilDB = $DIC[
'ilDB'];
901 if (!isset($a_rol_id) or !isset($a_ref_id)) {
902 $message = get_class($this) .
"::deleteRolePermission(): Missing parameter! role_id: " . $a_rol_id .
" ref_id: " . $a_ref_id;
903 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
907 if ($a_rol_id == SYSTEM_ROLE_ID) {
912 $and_type =
" AND type=" .
$ilDB->quote(
$a_type,
'text') .
" ";
915 $query =
'DELETE FROM rbac_templates ' .
916 'WHERE rol_id = ' .
$ilDB->quote($a_rol_id,
'integer') .
' ' .
917 'AND parent = ' .
$ilDB->quote($a_ref_id,
'integer') .
' ' .
939 $ilDB = $DIC[
'ilDB'];
941 if (!isset($a_rol_id) or !isset(
$a_type) or !isset($a_ops) or !isset($a_ref_id)) {
942 $message = get_class($this) .
"::setRolePermission(): Missing parameter!" .
943 " role_id: " . $a_rol_id .
945 " operations: " . $a_ops .
946 " ref_id: " . $a_ref_id;
947 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
951 $message = get_class($this) .
"::setRolePermission(): a_type is no string or empty!";
952 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
955 if (!is_array($a_ops) or empty($a_ops)) {
956 $message = get_class($this) .
"::setRolePermission(): a_ops is no array or empty!";
957 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
961 if ($a_rol_id == SYSTEM_ROLE_ID) {
965 foreach ($a_ops as $op) {
969 'rol_id' => [
'integer', $a_rol_id],
971 'ops_id' => [
'integer', $op],
972 'parent' => [
'integer', $a_ref_id]
997 $ilDB = $DIC[
'ilDB'];
998 $rbacreview = $DIC[
'rbacreview'];
1000 if (!isset($a_rol_id) or !isset($a_parent)) {
1001 $message = get_class($this) .
"::assignRoleToFolder(): Missing Parameter!" .
1002 " role_id: " . $a_rol_id .
1003 " parent_id: " . $a_parent .
1004 " assign: " . $a_assign;
1005 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
1009 if ($a_rol_id == SYSTEM_ROLE_ID) {
1014 if ($a_assign !=
"y") {
1019 $query =
'SELECT rol_id FROM rbac_fa ' .
1020 'WHERE rol_id = ' .
$ilDB->quote($a_rol_id,
'integer') .
' ' .
1021 'AND parent = ' .
$ilDB->quote($a_parent,
'integer');
1023 if (
$res->numRows()) {
1029 'INSERT INTO rbac_fa (rol_id, parent, assign, protected) ' .
1030 'VALUES (%s,%s,%s,%s)',
1031 $ilDB->quote($a_rol_id,
'integer'),
1032 $ilDB->quote($a_parent,
'integer'),
1033 $ilDB->quote($a_assign,
'text'),
1034 $ilDB->quote(
'n',
'text')
1053 $ilDB = $DIC[
'ilDB'];
1055 if (!isset($a_type_id) or !isset($a_ops_id)) {
1056 $message = get_class($this) .
"::assignOperationToObject(): Missing parameter!" .
1057 "type_id: " . $a_type_id .
1058 "ops_id: " . $a_ops_id;
1059 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
1062 $query =
"INSERT INTO rbac_ta (typ_id, ops_id) " .
1063 "VALUES(" .
$ilDB->quote($a_type_id,
'integer') .
"," .
$ilDB->quote($a_ops_id,
'integer') .
")";
1080 $ilDB = $DIC[
'ilDB'];
1082 if (!isset($a_type_id) or !isset($a_ops_id)) {
1083 $message = get_class($this) .
"::deassignPermissionFromObject(): Missing parameter!" .
1084 "type_id: " . $a_type_id .
1085 "ops_id: " . $a_ops_id;
1086 $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
1089 $query =
"DELETE FROM rbac_ta " .
1090 "WHERE typ_id = " .
$ilDB->quote($a_type_id,
'integer') .
" " .
1091 "AND ops_id = " .
$ilDB->quote($a_ops_id,
'integer');
1109 $ilDB = $DIC[
'ilDB'];
1113 $query =
'UPDATE rbac_fa ' .
1114 'SET protected = ' .
$ilDB->quote($a_value,
'text') .
' ' .
1115 'WHERE rol_id = ' .
$ilDB->quote($a_role_id,
'integer');
1134 $rbacreview = $DIC[
'rbacreview'];
1136 $ilObjDataCache = $DIC[
'ilObjDataCache'];
1138 $real_local = array();
1139 foreach ($rbacreview->getRolesOfRoleFolder($a_source_id,
false) as $role_data) {
1140 $title = $ilObjDataCache->lookupTitle($role_data);
1141 if (substr($title, 0, 3) ==
'il_') {
1144 $real_local[] = $role_data;
1146 if (!count($real_local)) {
1150 foreach ($real_local as $role) {
1151 include_once(
"./Services/AccessControl/classes/class.ilObjRole.php");
1155 $ilLog->write(__METHOD__ .
': Start copying of role ' . $orig->getTitle());
1157 $roleObj->setTitle($orig->getTitle());
1158 $roleObj->setDescription($orig->getDescription());
1159 $roleObj->setImportId($orig->getImportId());
1164 $ilLog->write(__METHOD__ .
': Added new local role, id ' . $roleObj->getId());
1182 $rbacreview = $DIC[
'rbacreview'];
1184 if ($rbacreview->isProtected($a_role_parent, $a_role_id)) {
1186 $new_ops = $rbacreview->getOperationsOfRole(
1200 if (!$a_template_id) {
1222 $new_ops = $rbacreview->getOperationsOfRole(
1250 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
1255 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
1260 $action->setRefId($a_ref_id);
1282 $rbacreview = $DIC[
'rbacreview'];
1283 $tree = $DIC[
'tree'];
1286 $new_parent = $tree->getParentId($a_ref_id);
1287 $old_context_roles = $rbacreview->getParentRoleIds($a_old_parent,
false);
1288 $new_context_roles = $rbacreview->getParentRoleIds($new_parent,
false);
1290 $for_addition = $for_deletion = array();
1291 foreach ($new_context_roles as $new_role_id => $new_role) {
1292 if (!isset($old_context_roles[$new_role_id])) {
1293 $for_addition[$new_role_id] = $new_role;
1294 } elseif ($new_role[
'parent'] != $old_context_roles[$new_role_id][
'parent']) {
1296 $for_deletion[$new_role_id] = $new_role;
1297 $for_addition[$new_role_id] = $new_role;
1300 foreach ($old_context_roles as $old_role_id => $old_role) {
1301 if (!isset($new_context_roles[$old_role_id])) {
1302 $for_deletion[$old_role_id] = $old_role;
1306 if (!count($for_deletion) and !count($for_addition)) {
1311 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1313 if ($rbac_log_active) {
1314 $role_ids = array_unique(array_merge(array_keys($for_deletion), array_keys($for_addition)));
1317 foreach ($nodes = $tree->getSubTree($tree->getNodeData($a_ref_id),
true) as $node_data) {
1318 $node_id = $node_data[
'child'];
1320 if ($rbac_log_active) {
1327 if (!$node_data[
'type']) {
1328 $ilLog->write(__METHOD__ .
': No type give. Choosing next tree entry.');
1333 $ilLog->write(__METHOD__ .
': Missing subtree node_id');
1337 foreach ($for_deletion as $role_id => $role_data) {
1342 foreach ($for_addition as $role_id => $role_data) {
1343 switch ($node_data[
'type']) {
1345 include_once
'./Modules/Group/classes/class.ilObjGroup.php';
1348 $node_data[
'child'],
1350 $role_data[
'parent'],
1357 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
1360 $node_data[
'child'],
1362 $role_data[
'parent'],
1372 $ops = $rbacreview->getOperationsOfRole($role_id, $node_data[
'type'], $role_data[
'parent']),
1384 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.
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.
assignUserLimited($a_role_id, $a_usr_id, $a_limit, $a_limited_roles=array())
Assign user limited.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
foreach($_POST as $key=> $value) $res
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)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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.
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.
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.