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)
 
   78                foreach($root->role as $roleElement)
 
   93                global $rbacadmin, $rbacreview, 
$lng;
 
   95                $import_id = (string) 
$role[
'id'];
 
   96                $GLOBALS[
'ilLog']->write(__METHOD__.
' Importing role with import id '. $import_id);
 
  103                $this->
getRole()->setTitle(trim((
string) 
$role->title));
 
  104                $this->
getRole()->setDescription(trim((
string) 
$role->description));
 
  107                $exp = explode(
"_", $this->
getRole()->getTitle());
 
  109                if(count($exp) > 0 && $exp[0] === 
"il")
 
  111                        if(count($exp) > 1 && $exp[1] !== $type)
 
  114                                        $lng->txt(
'obj_'.$exp[1]),
$lng->txt(
'obj_'.$type)));
 
  123                                $GLOBALS[
'ilLog']->write(__METHOD__.
': Overwrite role '. implode(
"_", $exp));
 
  124                                $this->
getRole()->setId($id[0]);
 
  141                $this->assignToRoleFolder();
 
  143                $protected = (string) 
$role[
'protected'];
 
  146                        $rbacadmin->setProtected(0,$this->
getRole()->getId(),
'y');
 
  150                $ops = $rbacreview->getOperations();
 
  151                $operations = array();
 
  152                foreach($ops as $ope)
 
  154                        $operations[$ope[
'operation']] = $ope[
'ops_id'];
 
  157                foreach(
$role->operations as $sxml_operations)
 
  159                        foreach($sxml_operations as $sxml_op)
 
  161                                $ops_group = (string) $sxml_op[
'group'];
 
  162                                $ops_id = (int) $operations[trim((
string) $sxml_op)];
 
  163                                $ops = trim((
string) $sxml_op);
 
  165                                if($ops_group and $ops_id)
 
  167                                        $rbacadmin->setRolePermission(
 
  176                                        $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot create operation for...');
 
  177                                        $GLOBALS[
'ilLog']->write(__METHOD__.
': New operation for group '. $ops_group);
 
  178                                        $GLOBALS[
'ilLog']->write(__METHOD__.
': New operation '.$ops);
 
  179                                        $GLOBALS[
'ilLog']->write(__METHOD__.
': New operation '. $ops_id);
 
  185                return $this->
getRole()->getId();
 
  195                global $rbacadmin, $rbacreview;
 
  202                if($rbacreview->isRoleAssignedToObject($this->getRole()->getId(),$this->getRoleFolderId()))
 
  207                $rbacadmin->assignRoleToFolder(
 
  223                include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  230                        include_once 
'./Services/AccessControl/classes/class.ilObjRoleTemplate.php';
 
  240                foreach(libxml_get_errors() as $err)
 
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.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.