summaryrefslogtreecommitdiffstats
path: root/application/controllers/ResourceController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/ResourceController.php')
-rwxr-xr-x[-rw-r--r--]application/controllers/ResourceController.php71
1 files changed, 70 insertions, 1 deletions
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index 751e691..bde3c42 100644..100755
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -1094,6 +1094,75 @@ class ResourceController extends Zend_Controller_Action
echo $xml;
}
+ public function getclientAction() {
+ list($rightroles1) = $this->rightrolesMapper->findBy(array('rightID' => '75', 'roleID' => $this->membership->getRoleID()));
+ if($rightroles1 == null){
+ header('HTTP/1.0 403 No Right to Show Groups');
+ die();
+ }
+
+ $apikey = $this->_request->getParam('apikey');
+ if($apikey == ""){
+ header('HTTP/1.0 400 No API-Key');
+ die();
+ }
+
+ $params = $this->_request->getParams();
+ $clientid = $params['clientid'];
+ $poolid = $params['poolid'];
+
+ if(!isset($clientid)) {
+ if(!isset($poolid)) {
+ header('HTTP/1.0 400 No ID');
+ die();
+ }
+ }
+
+ $clientMapper = new Application_Model_ClientMapper();
+
+ $clientlist = array();
+ if($poolid) {
+ $poolEntriesMapper = new Application_Model_PoolEntriesMapper();
+ $poolentries = $poolEntriesMapper->findBy(array("poolID" => $poolid));
+ foreach($poolentries as $entry) {
+ $client = new Application_Model_Client();
+ $clientMapper->find($entry->getClientID(), $client);
+ $clientlist[] = $client;
+ }
+ } else if($clientid) {
+ $client = new Application_Model_Client();
+ $clientMapper->find($clientid, $client);
+ $clientlist[] = $client;
+ }
+
+ $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ $xml .= "<xml>\n";
+ $xml .= "\t<clientlist>\n";
+ if(count($clientlist) > 0) {
+ foreach($clientlist as $client) {
+ $xml .= "\t\t<client>\n";
+ $xml .= "\t\t\t<clientID>" . $client->getID() . "</clientID>\n";
+ $xml .= "\t\t\t<groupID>" . $client->getGroupID() . "</groupID>\n";
+ $xml .= "\t\t\t<macadress>" . $client->getMacadress() . "</macadress>\n";
+ $xml .= "\t\t\t<ip>" . $client->getIp() . "</ip>\n";
+ $xml .= "\t\t\t<ip6>" . $client->getIp6() . "</ip6>\n";
+ $xml .= "\t\t\t<hardwarehash>" . $client->getHardwarehash() . "</hardwarehash>\n";
+ $xml .= "\t\t\t<created>" . $client->getCreated() . "</created>\n";
+ $xml .= "\t\t</client>\n";
+ }
+ } else {
+ $xml .= "\t\tno clients\n";
+ }
+ $xml .= "\t</clientlist>\n";
+ $xml .= "</xml>";
+
+ header('Content-Type: text/xml');
+ header('Content-Disposition: inline; filename="client.xml"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+ echo $xml;
+ }
+
public function getroleAction() {
$params = $this->_request->getParams();
@@ -1217,7 +1286,7 @@ class ResourceController extends Zend_Controller_Action
} else {
$xml .= "\t\t<success>true</success>\n";
$xml .= "\t\t<personid>" . $person->getID() . "</personid>";
-
+
$membershipMapper = new Application_Model_MembershipMapper();
$memberships = $membershipMapper->findBy(array('personID' => $person->getID()));
$xml .= "\t\t<membershiplist>\n";