/** * @param SimpleXMLElement $a */ public function simpleUserImportElement(SimpleXMLElement $a) { global $rbacadmin; $attributes = $a->attributes(); $action = $attributes->action; $user_id_type = $a->User->attributes()->id_type; $user_id = (string) $a->User; $org_unit_id_type = $a->OrgUnit->attributes()->id_type; $org_unit_id = (string) $a->OrgUnit; $role = (string) $a->Role; if (!($user_id = $this->buildUserId($user_id, $user_id_type))) { $this->addError('user_not_found', $a->User); return; } if (!($org_unit_id = $this->buildRef($org_unit_id, $org_unit_id_type))) { $this->addError('org_unit_not_found', $a->OrgUnit); return; } $org_unit = new ilObjOrgUnit($org_unit_id); if ($role == 'employee') { $role_id = $org_unit->getEmployeeRole(); } elseif ($role == 'superior') { $role_id = $org_unit->getSuperiorRole(); } else { $this->addError('not_a_valid_role', $user_id); return; } if ($action == 'add') { $rbacadmin->assignUser($role_id, $user_id); $this->stats['created']++; } elseif ($action == 'remove') { $rbacadmin->deassignUser($role_id, $user_id); $this->stats['removed']++; } else { $this->addError('not_a_valid_action', $user_id); } }