ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRoleXmlImporter Class Reference

Description of class. More...

+ Collaboration diagram for ilRoleXmlImporter:

Public Member Functions

 __construct ()
 Constructor.
 getRole ()
 Get role.
 importSimpleXml (SimpleXMLElement $role)
 Import using simplexml.

Protected Member Functions

 initRole ($import_id)

Detailed Description

Description of class.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 10 of file class.ilRoleXmlImporter.php.

Constructor & Destructor Documentation

ilRoleXmlImporter::__construct ( )

Constructor.

Definition at line 15 of file class.ilRoleXmlImporter.php.

{
}

Member Function Documentation

ilRoleXmlImporter::getRole ( )

Get role.

Returns
ilObjRole

Definition at line 25 of file class.ilRoleXmlImporter.php.

Referenced by importSimpleXml(), and initRole().

{
return $this->role;
}

+ Here is the caller graph for this function:

ilRoleXmlImporter::importSimpleXml ( SimpleXMLElement  $role)

Import using simplexml.

Parameters
SimpleXMLElement$role

Definition at line 35 of file class.ilRoleXmlImporter.php.

References $GLOBALS, getRole(), and initRole().

{
global $rbacadmin, $rbacreview;
$import_id = (string) $role['id'];
$GLOBALS['ilLog']->write(__METHOD__.' Importing role with import id '. $import_id);
if(!$this->initRole($import_id))
{
return 0;
}
$this->getRole()->setTitle(trim((string) $role->title));
$this->getRole()->setDescription(trim((string) $role->description));
// Create or update
if($this->getRole()->getId())
{
$this->getRole()->update();
}
else
{
$this->getRole()->create();
}
$rbacadmin->assignRoleToFolder(
$this->getRole()->getId(),
ROLE_FOLDER_ID,
$this->getRole() instanceof ilObjRole ? 'y' : 'n'
);
// Add operations
$ops = $rbacreview->getOperations();
$operations = array();
foreach($ops as $ope)
{
$operations[$ope['operation']] = $ope['ops_id'];
}
foreach($role->operations as $sxml_operations)
{
foreach($sxml_operations as $sxml_op)
{
$GLOBALS['ilLog']->write(__METHOD__.': New operation for group '. (string) $sxml_op['group']);
$GLOBALS['ilLog']->write(__METHOD__.': New operation '.trim((string) $sxml_op));
$GLOBALS['ilLog']->write(__METHOD__.': New operation '. $operations[trim((string) $sxml_op)]);
if(!strlen(trim((string) $sxml_op)))
{
continue;
}
$rbacadmin->setRolePermission(
$this->getRole()->getId(),
trim((string) $sxml_op['group']),
array($operations[trim((string) $sxml_op)]),
ROLE_FOLDER_ID
);
}
}
return $this->getRole()->getId();
}

+ Here is the call graph for this function:

ilRoleXmlImporter::initRole (   $import_id)
protected

Definition at line 102 of file class.ilRoleXmlImporter.php.

References ilObject\_lookupObjIdByImportId(), ilObjectFactory\getInstanceByObjId(), and getRole().

Referenced by importSimpleXml().

{
$obj_id = ilObject::_lookupObjIdByImportId($import_id);
include_once './classes/class.ilObjectFactory.php';
if($obj_id)
{
$this->role = ilObjectFactory::getInstanceByObjId($obj_id,false);
}
if(!$this->getRole() instanceof ilObjRole or !$this->getRole() instanceof ilObjRoleTemplate)
{
include_once './Services/AccessControl/classes/class.ilObjRoleTemplate.php';
$this->role = new ilObjRoleTemplate();
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: