function start() { global $rbacreview; if (!is_array($this->roles)) { return false; } $this->__buildHeader(); include_once './Services/AccessControl/classes/class.ilObjRole.php'; include_once './webservice/soap/classes/class.ilObjectXMLWriter.php'; foreach ($this->roles as $role) { // if role type is not empty and does not match, then continue; if (!empty($this->role_type) && strcasecmp($this->role_type, $role["role_type"]) != 0) { continue; } if ($rbacreview->isRoleDeleted($role["obj_id"])) { continue; } $attrs = array('role_type' => ucwords($role["role_type"]), 'id' => "il_" . IL_INST_ID . "_role_" . $role["obj_id"]); // open tag $this->xmlStartTag("Role", $attrs); $this->xmlElement('Title', null, $role["title"]); $this->xmlElement('Description', null, $role["description"]); $this->xmlElement('Translation', null, ilObjRole::_getTranslation($role["title"])); if ($ref_id = ilUtil::__extractRefId($role["title"])) { $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false); if (is_object($ownerObj)) { $attrs = array("obj_id" => "il_" . IL_INST_ID . "_" . $ownerObj->getType() . "_" . $ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType()); $this->xmlStartTag('AssignedObject', $attrs); $this->xmlElement('Title', null, $ownerObj->getTitle()); $this->xmlElement('Description', null, $ownerObj->getDescription()); ilObjectXMLWriter::appendPathToObject($this, $ref_id); $this->xmlEndTag('AssignedObject', $attrs); } } $this->xmlEndTag("Role"); } $this->__buildFooter(); return true; }
function __appendPath($refid) { ilObjectXMLWriter::appendPathToObject($this, $refid); }
function getXMLTree($sid, $ref_id, $types, $user_id) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } global $tree; $nodedata = $tree->getNodeData($ref_id); $nodearray = $tree->getSubTree($nodedata); $filter = (array) $types; global $objDefinition; foreach ($nodearray as $node) { if (!$objDefinition->isAdministrationObject($node['type']) && !$objDefinition->isSystemObject($node['type'])) { if (!in_array($node['type'], $filter)) { if ($tmp = ilObjectFactory::getInstanceByRefId($node['ref_id'], false)) { $nodes[] = $tmp; } } } } include_once './webservice/soap/classes/class.ilObjectXMLWriter.php'; $xml_writer = new ilObjectXMLWriter(); $xml_writer->enablePermissionCheck(true); $xml_writer->setObjects($nodes); $xml_writer->enableOperations(false); if ($user_id) { $xml_writer->setUserId($user_id); } if ($xml_writer->start()) { return $xml_writer->getXML(); } return $this->__raiseError('Cannot create object xml !', 'Server'); }
function getUserRoles($sid, $user_id) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } global $rbacreview; if (!($tmp_user =& ilObjectFactory::getInstanceByObjId($user_id, false))) { return $this->__raiseError('No valid user id given. Please choose an existing id of an ILIAS user', 'Client'); } foreach ($rbacreview->assignedRoles($user_id) as $role_id) { if ($tmp_obj = ilObjectFactory::getInstanceByObjId($role_id, false)) { $objs[] = $tmp_obj; } } if (count($objs)) { include_once './webservice/soap/classes/class.ilObjectXMLWriter.php'; $xml_writer = new ilObjectXMLWriter(); $xml_writer->setObjects($objs); if ($xml_writer->start()) { return $xml_writer->getXML(); } } return ''; }