4 include_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;
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));
118 $this->assignToRoleFolder();
120 $protected = (string) $role[
'protected'];
123 $rbacadmin->setProtected(0,$this->
getRole()->getId(),
'y');
127 $ops = $rbacreview->getOperations();
128 $operations = array();
129 foreach($ops as $ope)
131 $operations[$ope[
'operation']] = $ope[
'ops_id'];
134 foreach($role->operations as $sxml_operations)
136 foreach($sxml_operations as $sxml_op)
138 $ops_group = (string) $sxml_op[
'group'];
139 $ops_id = (int) $operations[trim((
string) $sxml_op)];
140 $ops = trim((
string) $sxml_op);
142 if($ops_group and $ops_id)
144 $rbacadmin->setRolePermission(
153 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot create operation for...');
154 $GLOBALS[
'ilLog']->write(__METHOD__.
': New operation for group '. $ops_group);
155 $GLOBALS[
'ilLog']->write(__METHOD__.
': New operation '.$ops);
156 $GLOBALS[
'ilLog']->write(__METHOD__.
': New operation '. $ops_id);
162 return $this->
getRole()->getId();
179 $rbacadmin->assignRoleToFolder(
195 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
202 include_once
'./Services/AccessControl/classes/class.ilObjRoleTemplate.php';
203 $this->role =
new ilObjRoleTemplate();
212 foreach(libxml_get_errors() as $err)