4include_once 
'./Services/AccessControl/exceptions/class.ilRoleImporterException.php';
 
   24        $this->role_folder = $a_role_folder_id;
 
   68    public function import()
 
   70        libxml_use_internal_errors(
true);
 
   72        $root = simplexml_load_string($this->
getXml());
 
   74        if (!$root instanceof SimpleXMLElement) {
 
   77        foreach ($root->role as $roleElement) {
 
   91        global $rbacadmin, $rbacreview, 
$lng;
 
   93        $import_id = (string) 
$role[
'id'];
 
   94        $GLOBALS[
'ilLog']->write(__METHOD__ . 
' Importing role with import id ' . $import_id);
 
  100        $this->
getRole()->setTitle(trim((
string) 
$role->title));
 
  101        $this->
getRole()->setDescription(trim((
string) 
$role->description));
 
  104        $exp = explode(
"_", $this->
getRole()->getTitle());
 
  106        if (count($exp) > 0 && $exp[0] === 
"il") {
 
  107            if (count($exp) > 1 && $exp[1] !== 
$type) {
 
  109                    $lng->txt(
"rbac_cant_import_role_wrong_type"),
 
  110                    $lng->txt(
'obj_' . $exp[1]),
 
  120                $GLOBALS[
'ilLog']->write(__METHOD__ . 
': Overwrite role ' . implode(
"_", $exp));
 
  127        if ($this->
getRole()->getId()) {
 
  135        $this->assignToRoleFolder();
 
  137        $protected = (string) 
$role[
'protected'];
 
  139            $rbacadmin->setProtected(0, $this->
getRole()->getId(), 
'y');
 
  143        $ops = $rbacreview->getOperations();
 
  144        $operations = array();
 
  145        foreach ($ops as $ope) {
 
  146            $operations[$ope[
'operation']] = $ope[
'ops_id'];
 
  149        foreach (
$role->operations as $sxml_operations) {
 
  150            foreach ($sxml_operations as $sxml_op) {
 
  151                $ops_group = (string) $sxml_op[
'group'];
 
  152                $ops_id = (int) $operations[trim((
string) $sxml_op)];
 
  153                $ops = trim((
string) $sxml_op);
 
  155                if ($ops_group and $ops_id) {
 
  156                    $rbacadmin->setRolePermission(
 
  163                    $GLOBALS[
'ilLog']->write(__METHOD__ . 
': Cannot create operation for...');
 
  164                    $GLOBALS[
'ilLog']->write(__METHOD__ . 
': New operation for group ' . $ops_group);
 
  165                    $GLOBALS[
'ilLog']->write(__METHOD__ . 
': New operation ' . $ops);
 
  166                    $GLOBALS[
'ilLog']->write(__METHOD__ . 
': New operation ' . $ops_id);
 
  171        return $this->
getRole()->getId();
 
  181        global $rbacadmin, $rbacreview;
 
  187        if ($rbacreview->isRoleAssignedToObject($this->getRole()->getId(), $this->getRoleFolderId())) {
 
  191        $rbacadmin->assignRoleToFolder(
 
  206        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  211            include_once 
'./Services/AccessControl/classes/class.ilObjRoleTemplate.php';
 
  221        foreach (libxml_get_errors() as $err) {
 
  222            $errors .= $err->code . 
'<br/>';
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObject Basic functions for all objects.
static _lookupObjIdByImportId($a_import_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getIdsForTitle($title, $type='', $partialmatch=false)
__construct($a_role_folder_id=0)
Constructor.
getRoleFolderId()
Get role folder id.
assigntoRoleFolder()
Assign role to folder @global type $rbacadmin.
setRole(ilObject $role)
Set role or role template.
importSimpleXml(SimpleXMLElement $role)
Import using simplexml.
if(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['loaded']
Global hash that tracks already loaded includes.