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');
 
   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');
 
  105        if (!isset($a_rol_id) || !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);
 
  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') . 
" ";
 
  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');
 
  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);
 
  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') . 
' ' .
 
  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);
 
  269        $rbacreview = 
$DIC[
'rbacreview'];
 
  271        if (!isset($a_rol_id) || !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,
 
  327        $rbacreview = 
$DIC->rbac()->review();
 
  329        if (!isset($a_rol_id) || !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,
 
  376        if (!isset($a_rol_id) || !isset($a_ops) || !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
 
  394        foreach ($a_ops as $key => $operation) {
 
  395            $a_ops[$key] = (int) $operation;
 
  399        $ops_ids = serialize($a_ops);
 
  401        $query = 
'DELETE FROM rbac_pa ' .
 
  402            'WHERE rol_id = %s ' .
 
  406            array(
'integer',
'integer'),
 
  407            array($a_rol_id,$a_ref_id)
 
  410        if (!count($a_ops)) {
 
  414        $query = 
"INSERT INTO rbac_pa (rol_id, ops_id, ref_id) " .
 
  416             "(" . 
$ilDB->quote($a_rol_id, 
'integer') . 
", " . 
$ilDB->quote($ops_ids, 
'text') . 
", " . 
$ilDB->quote($a_ref_id, 
'integer') . 
")";
 
  435        $rbacreview = 
$DIC[
'rbacreview'];
 
  438        $ilLog = 
$DIC[
'ilLog'];
 
  440        if (!isset($a_ref_id)) {
 
  442            $message = get_class($this) . 
"::revokePermission(): Missing parameter! ref_id: " . $a_ref_id;
 
  443            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  447        if ($a_keep_protected != 
true) {
 
  454                $and1 = 
" AND rol_id = " . 
$ilDB->quote($a_rol_id, 
'integer') . 
" ";
 
  459            $query = 
"DELETE FROM rbac_pa " .
 
  460                 "WHERE ref_id = " . 
$ilDB->quote($a_ref_id, 
'integer') .
 
  471        $roles_in_scope = $rbacreview->getParentRoleIds($a_ref_id);
 
  476            foreach ($roles_in_scope as $role) {
 
  477                if ($role[
'protected'] == 
true) {
 
  481                $role_ids[] = $role[
'obj_id'];
 
  489            $query = 
'DELETE FROM rbac_pa ' .
 
  490                'WHERE ' . 
$ilDB->in(
'rol_id', $role_ids, 
false, 
'integer') . 
' ' .
 
  491                'AND ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer');
 
  500            if ($roles_in_scope[$a_rol_id][
'protected'] == 
true) {
 
  504            $query = 
"DELETE FROM rbac_pa " .
 
  505                 "WHERE ref_id = " . 
$ilDB->quote($a_ref_id, 
'integer') . 
" " .
 
  506                 "AND rol_id = " . 
$ilDB->quote($a_rol_id, 
'integer') . 
" ";
 
  525        $query = 
'DELETE FROM rbac_pa ' .
 
  527                '( ' . 
$GLOBALS[
'DIC'][
'tree']->getSubTreeQuery($a_ref_id, array(
'child')) . 
' ) ' .
 
  528                'AND rol_id = ' . 
$ilDB->quote($a_role_id, 
'integer');
 
  546        $query = 
'DELETE FROM rbac_templates ' .
 
  547                'WHERE parent IN ( ' .
 
  548                $GLOBALS[
'DIC'][
'tree']->getSubTreeQuery($a_ref_id, array(
'child')) . 
' ) ' .
 
  549                'AND rol_id = ' . 
$ilDB->quote($a_rol_id, 
'integer');
 
  553        $query = 
'DELETE FROM rbac_fa ' .
 
  554                'WHERE parent IN ( ' .
 
  555                $GLOBALS[
'DIC'][
'tree']->getSubTreeQuery($a_ref_id, array(
'child')) . 
' ) ' .
 
  556                'AND rol_id = ' . 
$ilDB->quote($a_rol_id, 
'integer');
 
  576        if (!isset($a_ref_ids) || !is_array($a_ref_ids)) {
 
  577            $message = get_class($this) . 
"::revokePermissionList(): Missing parameter or parameter is not an array! reference_list: " . var_dump($a_ref_ids);
 
  578            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  581        if (!isset($a_rol_id)) {
 
  582            $message = get_class($this) . 
"::revokePermissionList(): Missing parameter! rol_id: " . $a_rol_id;
 
  583            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  591        $query = 
"DELETE FROM rbac_pa " .
 
  592             "WHERE " . 
$ilDB->in(
'ref_id', $a_ref_ids, 
false, 
'integer') . 
' ' .
 
  593             "AND rol_id = " . 
$ilDB->quote($a_rol_id, 
'integer');
 
  609    public function copyRolePermissions($a_source_id, $a_source_parent, $a_dest_parent, $a_dest_id, $a_consider_protected = 
true)
 
  613        $tree = 
$DIC[
'tree'];
 
  614        $rbacreview = 
$DIC[
'rbacreview'];
 
  619        $ops = $rbacreview->getRoleOperationsOnObject($a_source_id, $a_source_parent);
 
  640        $rbacreview = 
$DIC[
'rbacreview'];
 
  643        if (!isset($a_source_id) || !isset($a_source_parent) || !isset($a_dest_id) || !isset($a_dest_parent)) {
 
  644            $message = __METHOD__ . 
": Missing parameter! source_id: " . $a_source_id .
 
  645                       " source_parent_id: " . $a_source_parent .
 
  646                       " dest_id : " . $a_dest_id .
 
  647                       " dest_parent_id: " . $a_dest_parent;
 
  648            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  657        $query = 
'SELECT * FROM rbac_templates ' .
 
  658             'WHERE rol_id = ' . 
$ilDB->quote($a_source_id, 
'integer') . 
' ' .
 
  659             'AND parent = ' . 
$ilDB->quote($a_source_parent, 
'integer');
 
  663        while ($row = 
$ilDB->fetchObject(
$res)) {
 
  664            $operations[$rownum][
'type'] = $row->type;
 
  665            $operations[$rownum][
'ops_id'] = $row->ops_id;
 
  670        $query = 
'DELETE FROM rbac_templates WHERE rol_id = ' . 
$ilDB->quote($a_dest_id, 
'integer') . 
' ' .
 
  671            'AND parent = ' . 
$ilDB->quote($a_dest_parent, 
'integer');
 
  674        foreach ($operations as $row => $op) {
 
  675            $query = 
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
 
  677                 $ilDB->quote($a_dest_id, 
'integer') . 
"," .
 
  678                 $ilDB->quote($op[
'type'], 
'text') . 
"," .
 
  679                 $ilDB->quote($op[
'ops_id'], 
'integer') . 
"," .
 
  680                 $ilDB->quote($a_dest_parent, 
'integer') . 
")";
 
  685        if ($a_consider_protected == 
true) {
 
  686            if ($rbacreview->isProtected($a_source_parent, $a_source_id)) {
 
  710        $rbacreview = 
$DIC[
'rbacreview'];
 
  713        if (!isset($a_source1_id) || !isset($a_source1_parent)
 
  714            || !isset($a_source2_id) || !isset($a_source2_parent)
 
  715            || !isset($a_dest_id) || !isset($a_dest_parent)) {
 
  716            $message = get_class($this) . 
"::copyRolePermissionIntersection(): Missing parameter! source1_id: " . $a_source1_id .
 
  717                       " source1_parent: " . $a_source1_parent .
 
  718                       " source2_id: " . $a_source2_id .
 
  719                       " source2_parent: " . $a_source2_parent .
 
  720                       " dest_id: " . $a_dest_id .
 
  721                       " dest_parent_id: " . $a_dest_parent;
 
  722            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  731        if ($rbacreview->isProtected($a_source2_parent, $a_source2_id)) {
 
  732            $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': Role is protected');
 
  736        $query = 
"SELECT s1.type, s1.ops_id " .
 
  737                        "FROM rbac_templates s1, rbac_templates s2 " .
 
  738                        "WHERE s1.rol_id = " . 
$ilDB->quote($a_source1_id, 
'integer') . 
" " .
 
  739                        "AND s1.parent = " . 
$ilDB->quote($a_source1_parent, 
'integer') . 
" " .
 
  740                        "AND s2.rol_id = " . 
$ilDB->quote($a_source2_id, 
'integer') . 
" " .
 
  741                        "AND s2.parent = " . 
$ilDB->quote($a_source2_parent, 
'integer') . 
" " .
 
  742                        "AND s1.type = s2.type " .
 
  743                        "AND s1.ops_id = s2.ops_id";
 
  751            $operations[$rowNum][
'type'] = $row->type;
 
  752            $operations[$rowNum][
'ops_id'] = $row->ops_id;
 
  758        $query = 
'DELETE FROM rbac_templates WHERE rol_id = ' . 
$ilDB->quote($a_dest_id, 
'integer') . 
' ' .
 
  759            'AND parent = ' . 
$ilDB->quote($a_dest_parent, 
'integer');
 
  762        $query = 
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
 
  764        $sta = 
$ilDB->prepareManip(
$query, array(
'integer',
'text',
'integer',
'integer'));
 
  765        foreach ($operations as $key => $set) {
 
  766            $ilDB->execute($sta, array(
 
  797        $rbacreview = 
$DIC[
'rbacreview'];
 
  800        $s1_ops = $rbacreview->getAllOperationsOfRole($a_source1_id, $a_source1_parent);
 
  801        $s2_ops = $rbacreview->getAlloperationsOfRole($a_source2_id, $a_source2_parent);
 
  805        $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': ' . print_r($s1_ops, 
true));
 
  806        $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': ' . print_r($s2_ops, 
true));
 
  808        foreach ($s1_ops as 
$type => $ops) {
 
  809            foreach ($ops as $op) {
 
  812                $query = 
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
 
  814                    $ilDB->quote($a_dest_id, 
'integer') . 
', ' .
 
  816                    $ilDB->quote($op, 
'integer') . 
', ' .
 
  817                    $ilDB->quote($a_dest_parent, 
'integer') . 
' ' .
 
  824        foreach ($s2_ops as 
$type => $ops) {
 
  825            foreach ($ops as $op) {
 
  826                if (!isset($s1_ops[
$type]) || !in_array($op, $s1_ops[
$type])) {
 
  827                    $query = 
'INSERT INTO rbac_templates (rol_id,type,ops_id,parent) ' .
 
  829                        $ilDB->quote($a_dest_id, 
'integer') . 
', ' .
 
  831                        $ilDB->quote($op, 
'integer') . 
', ' .
 
  832                        $ilDB->quote($a_dest_parent, 
'integer') . 
' ' .
 
  853        $rbacreview = 
$DIC[
'rbacreview'];
 
  856        $s1_ops = $rbacreview->getAllOperationsOfRole($a_source_id, $a_source_parent);
 
  857        $d_ops = $rbacreview->getAllOperationsOfRole($a_dest_id, $a_dest_parent);
 
  859        foreach ($s1_ops as 
$type => $ops) {
 
  860            foreach ($ops as $op) {
 
  861                if (isset($d_ops[
$type]) && in_array($op, $d_ops[
$type])) {
 
  862                    $query = 
'DELETE FROM rbac_templates ' .
 
  863                            'WHERE rol_id = ' . 
$ilDB->quote($a_dest_id, 
'integer') . 
' ' .
 
  864                            'AND type = ' . 
$ilDB->quote(
$type, 
'text') . 
' ' .
 
  865                            'AND ops_id = ' . 
$ilDB->quote($op, 
'integer') . 
' ' .
 
  866                            'AND parent = ' . 
$ilDB->quote($a_dest_parent, 
'integer');
 
  891        if (!isset($a_rol_id) || !isset($a_ref_id)) {
 
  892            $message = get_class($this) . 
"::deleteRolePermission(): Missing parameter! role_id: " . $a_rol_id . 
" ref_id: " . $a_ref_id;
 
  893            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  901        if ($a_type !== 
false) {
 
  902            $and_type = 
" AND type=" . 
$ilDB->quote($a_type, 
'text') . 
" ";
 
  905        $query = 
'DELETE FROM rbac_templates ' .
 
  906             'WHERE rol_id = ' . 
$ilDB->quote($a_rol_id, 
'integer') . 
' ' .
 
  907             'AND parent = ' . 
$ilDB->quote($a_ref_id, 
'integer') . 
' ' .
 
  931        if (!isset($a_rol_id) || !isset($a_type) || !isset($a_ops) || !isset($a_ref_id)) {
 
  932            $message = get_class($this) . 
"::setRolePermission(): Missing parameter!" .
 
  933                       " role_id: " . $a_rol_id .
 
  934                       " type: " . $a_type .
 
  935                       " operations: " . $a_ops .
 
  936                       " ref_id: " . $a_ref_id;
 
  937            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  940        if (!is_string($a_type) || empty($a_type)) {
 
  941            $message = get_class($this) . 
"::setRolePermission(): a_type is no string or empty!";
 
  942            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  945        if (!is_array($a_ops) || empty($a_ops)) {
 
  946            $message = get_class($this) . 
"::setRolePermission(): a_ops is no array or empty!";
 
  947            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
  955        foreach ($a_ops as $op) {
 
  959                    'rol_id' => [
'integer', $a_rol_id],
 
  960                    'type' => [
'text', $a_type],
 
  961                    'ops_id' => [
'integer', $op],
 
  962                    'parent' => [
'integer', $a_ref_id]
 
  988        if (!isset($a_rol_id) || !isset($a_parent)) {
 
  989            $message = get_class($this) . 
"::assignRoleToFolder(): Missing Parameter!" .
 
  990                       " role_id: " . $a_rol_id .
 
  991                       " parent_id: " . $a_parent .
 
  992                       " assign: " . $a_assign;
 
  993            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
 1002        if ($a_assign != 
"y") {
 
 1007        $query = 
'SELECT rol_id FROM rbac_fa ' .
 
 1008            'WHERE rol_id = ' . 
$ilDB->quote($a_rol_id, 
'integer') . 
' ' .
 
 1009            'AND parent = ' . 
$ilDB->quote($a_parent, 
'integer');
 
 1011        if (
$res->numRows()) {
 
 1017            'INSERT INTO rbac_fa (rol_id, parent, assign, protected) ' .
 
 1018            'VALUES (%s,%s,%s,%s)',
 
 1019            $ilDB->quote($a_rol_id, 
'integer'),
 
 1020            $ilDB->quote($a_parent, 
'integer'),
 
 1021            $ilDB->quote($a_assign, 
'text'),
 
 1022            $ilDB->quote(
'n', 
'text')
 
 1043        if (!isset($a_type_id) || !isset($a_ops_id)) {
 
 1044            $message = get_class($this) . 
"::assignOperationToObject(): Missing parameter!" .
 
 1045                       "type_id: " . $a_type_id .
 
 1046                       "ops_id: " . $a_ops_id;
 
 1047            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
 1050        $query = 
"INSERT INTO rbac_ta (typ_id, ops_id) " .
 
 1051             "VALUES(" . 
$ilDB->quote($a_type_id, 
'integer') . 
"," . 
$ilDB->quote($a_ops_id, 
'integer') . 
")";
 
 1070        if (!isset($a_type_id) || !isset($a_ops_id)) {
 
 1071            $message = get_class($this) . 
"::deassignPermissionFromObject(): Missing parameter!" .
 
 1072                       "type_id: " . $a_type_id .
 
 1073                       "ops_id: " . $a_ops_id;
 
 1074            $this->ilErr->raiseError(
$message, $this->ilErr->WARNING);
 
 1077        $query = 
"DELETE FROM rbac_ta " .
 
 1078             "WHERE typ_id = " . 
$ilDB->quote($a_type_id, 
'integer') . 
" " .
 
 1079             "AND ops_id = " . 
$ilDB->quote($a_ops_id, 
'integer');
 
 1101        $query = 
'UPDATE rbac_fa ' .
 
 1102            'SET protected = ' . 
$ilDB->quote($a_value, 
'text') . 
' ' .
 
 1103            'WHERE rol_id = ' . 
$ilDB->quote($a_role_id, 
'integer');
 
 1122        $rbacreview = 
$DIC[
'rbacreview'];
 
 1123        $ilLog = 
$DIC[
'ilLog'];
 
 1124        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
 1127        foreach ($rbacreview->getRolesOfRoleFolder($a_source_id, 
false) as $role_data) {
 
 1128            $title = $ilObjDataCache->lookupTitle($role_data);
 
 1129            if (substr($title, 0, 3) == 
'il_') {
 
 1132            $real_local[] = $role_data;
 
 1134        if (!count($real_local)) {
 
 1138        foreach ($real_local as $role) {
 
 1139            include_once(
"./Services/AccessControl/classes/class.ilObjRole.php");
 
 1143            $ilLog->write(__METHOD__ . 
': Start copying of role ' . $orig->getTitle());
 
 1145            $roleObj->setTitle($orig->getTitle());
 
 1146            $roleObj->setDescription($orig->getDescription());
 
 1147            $roleObj->setImportId($orig->getImportId());
 
 1152            $ilLog->write(__METHOD__ . 
': Added new local role, id ' . $roleObj->getId());
 
 1170        $rbacreview = 
$DIC[
'rbacreview'];
 
 1172        if ($rbacreview->isProtected($a_role_parent, $a_role_id)) {
 
 1174            $new_ops = $rbacreview->getOperationsOfRole(
 
 1188        if (!$a_template_id) {
 
 1210        $new_ops = $rbacreview->getOperationsOfRole(
 
 1238        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1243        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
 
 1248            $action->setRefId($a_ref_id);
 
 1270        $rbacreview = 
$DIC[
'rbacreview'];
 
 1271        $tree = 
$DIC[
'tree'];
 
 1272        $ilLog = 
$DIC[
'ilLog'];
 
 1274        $new_parent = $tree->getParentId($ref_id);
 
 1275        $old_context_roles = $rbacreview->getParentRoleIds($old_parent, 
false);
 
 1276        $new_context_roles = $rbacreview->getParentRoleIds($new_parent, 
false);
 
 1283        $tree->useCache(
false);
 
 1285        $for_addition = $for_deletion = [];
 
 1286        foreach ($new_context_roles as $new_role_id => $new_role) {
 
 1287            if (!isset($old_context_roles[$new_role_id])) {
 
 1288                $for_addition[] = $new_role_id;
 
 1289            } elseif ($new_role[
'parent'] != $old_context_roles[$new_role_id][
'parent']) {
 
 1291                $for_deletion[] = $new_role_id;
 
 1292                $for_addition[] = $new_role_id;
 
 1295        foreach ($old_context_roles as $old_role_id => $old_role) {
 
 1296            if (!isset($new_context_roles[$old_role_id])) {
 
 1297                $for_deletion[] = $old_role_id;
 
 1301        if (!count($for_deletion) && !count($for_addition)) {
 
 1307        if ($rbac_log_active) {
 
 1308            $role_ids = array_unique(array_merge(array_keys($for_deletion), array_keys($for_addition)));
 
 1311        foreach ($tree->getSubTree($tree->getNodeData($ref_id), 
true) as $node_data) {
 
 1312            $node_id = $node_data[
'child'];
 
 1314            if ($rbac_log_active) {
 
 1321            if (!$node_data[
'type']) {
 
 1322                $ilLog->write(__METHOD__ . 
': No type give. Choosing next tree entry.');
 
 1327                $ilLog->write(__METHOD__ . 
': Missing subtree node_id');
 
 1331            foreach ($for_deletion as $role_id) {
 
 1335            foreach ($for_addition as $role_id) {
 
 1336                $role_parent_id = $rbacreview->getParentOfRole($role_id, $ref_id);
 
 1337                switch ($node_data[
'type']) {
 
 1341                            $node_data[
'child'],
 
 1352                            $node_data[
'child'],
 
 1363                            $rbacreview->getOperationsOfRole($role_id, $node_data[
'type'], $role_parent_id),
 
 1371            if ($rbac_log_active) {
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
const PEAR_ERROR_CALLBACK
An exception for terminatinating execution or to throw for unit testing.
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
represents a creation of local roles action
static lookupTemplateId($a_ref_id)
Lookup template id @global ilDB $ilDB.
static _getInstance()
Get singleton instance of this class.
static getLogger($a_component_id)
Get component logger.
static lookupCourseNonMemberTemplatesId()
Lookup course non member id.
static lookupGroupStatusTemplateId($a_obj_id)
@global $ilDB $ilDB
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilRbacAdmin Core functions for role based access control.
setProtected($a_ref_id, $a_role_id, $a_value)
Set protected @global $ilDB.
revokePermission($a_ref_id, $a_rol_id=0, $a_keep_protected=true)
Revokes permissions of an object of one role.
deleteRole($a_rol_id, $a_ref_id)
Deletes a role and deletes entries in object_data, rbac_pa, rbac_templates, rbac_ua,...
deleteSubtreeTemplates($a_ref_id, $a_rol_id)
Delete all template permissions of subtree nodes.
__construct()
Constructor @access public.
adjustMovedObjectPermissions($ref_id, $old_parent)
Adjust permissions of moved objects.
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.
deassignOperationFromObject($a_type_id, $a_ops_id)
Deassign an existing operation from an object Update of rbac_ta @access public.
assignUser($a_rol_id, $a_usr_id)
Assigns an user to a role.
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.
removeUser($a_usr_id)
deletes a user from rbac_ua all user <-> role relations are deleted @access public
deleteLocalRole($a_rol_id, $a_ref_id=0)
Deletes a local role and entries in rbac_fa and rbac_templates @access public.
copyLocalRoles($a_source_id, $a_target_id)
Copy local roles This method creates a copy of all local role.
revokePermissionList($a_ref_ids, $a_rol_id)
Revokes permissions of a LIST of objects of ONE role.
assignUserLimited($a_role_id, $a_usr_id, $a_limit, $a_limited_roles=[])
Assign user limited.
setRolePermission($a_rol_id, $a_type, $a_ops, $a_ref_id)
Inserts template permissions in rbac_templates for an specific object type.
initIntersectionPermissions($a_ref_id, $a_role_id, $a_role_parent, $a_template_id, $a_template_parent)
Init intersection permissions.
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.
applyMovedObjectDidacticTemplates($a_ref_id, $a_old_parent)
Apply didactic templates after object movement.
copyRolePermissionUnion( $a_source1_id, $a_source1_parent, $a_source2_id, $a_source2_parent, $a_dest_id, $a_dest_parent)
@global <type> $ilDB
deassignUser($a_rol_id, $a_usr_id)
Deassigns a user from a role.
setBlockedStatus($a_role_id, $a_ref_id, $a_blocked_status)
Set blocked status.
revokeSubtreePermissions($a_ref_id, $a_role_id)
Revoke subtree permissions.
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.
assignOperationToObject($a_type_id, $a_ops_id)
Assign an existing operation to an object Update of rbac_ta.
deleteTemplate($a_obj_id)
Deletes a template from role folder and deletes all entries in rbac_templates, rbac_fa @access public...
grantPermission($a_rol_id, $a_ops, $a_ref_id)
Grants a permission to an object and a specific role.
deleteRolePermission($a_rol_id, $a_ref_id, $a_type=false)
Deletes all entries of a template.
copyRolePermissionSubtract($a_source_id, $a_source_parent, $a_dest_id, $a_dest_parent)
Subtract role permissions.
static diffFaPa(array $a_old, array $a_new)
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
foreach($_POST as $key=> $value) $res