public static function getRelatedFromApi(Api $api) { $ret = array(); $pm = new PolicyManager(); $am = new AuthManager(); $allPolicies = $pm->getAllPolicies(true); $relatedPolicies = array(); $policyPropsArr = array(); $allAuths = $am->getAllAuths(true); $relatedAuthIds = array(); $relatedAuths = array(); $authPropsArr = array(); foreach ($allPolicies as $policy) { /** * @var Policy $policy */ $apiIds = $policy->getApiIds(); foreach ($apiIds as $apiId) { if ($apiId === $api->getId()) { $relatedPolicies[] = $policy; } } } foreach ($relatedPolicies as $policy) { $props = $policy->getProperties(); if (!empty($props)) { $policyPropsArr[$policy->getId()] = array_keys($props); } foreach ($policy->getAuthIds() as $authBucket) { if ($authBucket && $authBucket->getAuthIds()) { $relatedAuthIds = array_unique(array_merge($relatedAuthIds, $authBucket->getAuthIds())); } } } foreach ($allAuths as $auth) { /** * @var $auth Auth */ if (in_array($auth->getId(), $relatedAuthIds)) { $relatedAuths[] = $auth; } } foreach ($relatedAuths as $auth) { $props = $auth->getProperties(); if (!empty($props)) { $authPropsArr[$auth->getId()] = array_keys($props); } } if (!empty($policyPropsArr)) { $ret["policy"] = $policyPropsArr; } if (!empty($authPropsArr)) { $ret["auth"] = $authPropsArr; } return json_encode($ret); }
<?php echo '<title>' . _('Users configuration') . '</title>'; $request = new Api(); $request->add_request('profileList'); $result = $request->send_request(); $listuser = $result->profileList; $currentuser = $request->getId();
<?php echo '<title>' . _('Profile') . '</title>'; $request = new Api(); $request->add_request('confUserInstallation', array('')); $request->add_request('profileList'); $result = $request->send_request(); $userid = $request->getId(); $listuser = $result->profileList; $accordioninfo = $result->confUserInstallation;
<?php include 'header.php'; $request = new Api(); $request->add_request('mcAllowed'); $request->add_request('confUserRoomEnable'); $result = $request->send_request(); if (empty($result->confUserRoomEnable) || sizeof($result->confUserRoomEnable) == 0) { $listAllVisible = $result->mcAllowed; $rooms = $listAllVisible->ListRoom; } else { $rooms = $result->confUserRoomEnable; } if (empty($_POST['userid'])) { $iduser = $request->getId(); } else { $iduser = $_POST['userid']; } $target_dir_abs = "/etc/domoleaf/www/templates/default/custom/room/"; $target_dir = "/templates/default/custom/room/"; $target_file = $target_dir_abs . basename($_FILES["fileToUpload"]["name"]); $imageFileType = "jpg"; $uploadOk = 0; if (!empty($_POST['id_elem']) && !empty($rooms->{$_POST['id_elem']}) && !empty($iduser)) { $filename = $iduser . '_' . $_POST['id_elem'] . '_' . $_SERVER['REQUEST_TIME'] . '.' . $imageFileType; $target_file = $target_dir_abs . $filename; if (empty($_FILES["fileToUpload"]["tmp_name"]) || empty($target_file)) { echo 0; } if (!move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo 0;
/** * * Insert/Update an Api on the database * @param Api $api * @throws Exception */ public function setApi(Api &$api, $insertMode = FALSE) { $method = "PUT"; $path = "/cxf/e3/prov/v1/apis/" . rawurlencode($api->getId()); if ($insertMode) { $method = "POST"; $path = "/cxf/e3/prov/v1/apis/"; } /** * Send the XML payload the the Provisioning Backend */ $api->toXML(); LoggerInterface::log(($insertMode ? "Creating" : "Updating") . " API: {$api->toXML()}\nEndpoint: ({$method}) {$path}", LoggerInterface::INFO); $reply = $this->restClient->makeCall($path, $method, $api->toXML()); $xml = simplexml_load_string($reply->getPayload()); $api->setId((string) $xml->id); return $xml; }