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);
77 foreach (
$root->role as $roleElement) {
93 $rbacadmin = $DIC[
'rbacadmin'];
94 $rbacreview = $DIC[
'rbacreview'];
97 $import_id = (string) $role[
'id'];
98 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
' Importing role with import id ' . $import_id);
104 $this->
getRole()->setTitle(trim((
string) $role->title));
105 $this->
getRole()->setDescription(trim((
string) $role->description));
108 $exp = explode(
"_", $this->
getRole()->getTitle());
110 if (count($exp) > 0 && $exp[0] ===
"il") {
111 if (count($exp) > 1 && $exp[1] !==
$type) {
113 $lng->txt(
"rbac_cant_import_role_wrong_type"),
114 $lng->txt(
'obj_' . $exp[1]),
124 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Overwrite role ' . implode(
"_", $exp));
131 if ($this->
getRole()->getId()) {
139 $this->assignToRoleFolder();
141 $protected = (string) $role[
'protected'];
143 $rbacadmin->setProtected(0, $this->
getRole()->getId(),
'y');
147 $ops = $rbacreview->getOperations();
148 $operations = array();
149 foreach ($ops as $ope) {
150 $operations[$ope[
'operation']] = $ope[
'ops_id'];
153 foreach ($role->operations as $sxml_operations) {
154 foreach ($sxml_operations as $sxml_op) {
155 $ops_group = (string) $sxml_op[
'group'];
156 $ops_id = (int) $operations[trim((
string) $sxml_op)];
157 $ops = trim((
string) $sxml_op);
159 if ($ops_group
and $ops_id) {
160 $rbacadmin->setRolePermission(
167 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Cannot create operation for...');
168 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': New operation for group ' . $ops_group);
169 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': New operation ' . $ops);
170 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': New operation ' . $ops_id);
175 return $this->
getRole()->getId();
187 $rbacadmin = $DIC[
'rbacadmin'];
188 $rbacreview = $DIC[
'rbacreview'];
194 if ($rbacreview->isRoleAssignedToObject($this->getRole()->getId(), $this->
getRoleFolderId())) {
198 $rbacadmin->assignRoleToFolder(
213 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
218 include_once
'./Services/AccessControl/classes/class.ilObjRoleTemplate.php';
219 $this->role =
new ilObjRoleTemplate();
228 foreach (libxml_get_errors() as $err) {
229 $errors .= $err->code .
'<br/>';
importSimpleXml(SimpleXMLElement $role)
Import using simplexml.
setRole(ilObject $role)
Set role or role template.
if(!array_key_exists('StateId', $_REQUEST)) $id
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
getRoleFolderId()
Get role folder id.
static _getIdsForTitle($title, $type='', $partialmatch=false)
__construct($a_role_folder_id=0)
Constructor.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static _lookupObjIdByImportId($a_import_id)
assigntoRoleFolder()
Assign role to folder type $rbacadmin.