summaryrefslogtreecommitdiffstats
path: root/application/controllers/ResourceController.php
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-05 13:01:01 +0200
committerBjörn Geiger2011-08-05 13:01:01 +0200
commit0af67bb60e32b3c8e56e1c7869b17aa38c4f833a (patch)
treeb839ae495b1295a44258e920168191127b6c0f04 /application/controllers/ResourceController.php
parentMembershipAPI hinzugefügt (diff)
downloadpbs2-0af67bb60e32b3c8e56e1c7869b17aa38c4f833a.tar.gz
pbs2-0af67bb60e32b3c8e56e1c7869b17aa38c4f833a.tar.xz
pbs2-0af67bb60e32b3c8e56e1c7869b17aa38c4f833a.zip
checkright API
Diffstat (limited to 'application/controllers/ResourceController.php')
-rw-r--r--application/controllers/ResourceController.php45
1 files changed, 44 insertions, 1 deletions
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index cb993fe..2ec373a 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -1011,7 +1011,7 @@ class ResourceController extends Zend_Controller_Action
die();
}
- $membershipMapper = new Application_Model_MembershipMapper();
+ $membershipMapper = new Application_Model_MembershipMaper();
$membershipid = $this->membership->getID();
$membership = new Application_Model_Membership();
$membershipMapper->find($membershipid, $membership);
@@ -1035,6 +1035,49 @@ class ResourceController extends Zend_Controller_Action
echo $xml;
}
+ public function checkrightAction() {
+ $apikey = $this->_request->getParam('apikey');
+ if($apikey == ""){
+ header('HTTP/1.0 400 No API-Key');
+ die();
+ }
+
+ $rightShortcut = $this->_request->getParam('rightShortcut');
+ $rightMapper = new Application_Model_RightMapper();
+ $result = $rightMapper->findBy(array('shortcut' => $rightShortcut));
+ if(!is_array($result[0])) {
+ header('HTTP/1.0 400 Wrong Right Shortcut');
+ die();
+ }
+ $right = new Application_Model_Right($result[0]);
+ $right->setID($result[0]['rightID']);
+
+ $roleid = $this->membership->getRoleID();
+ $rightid = $right->getID();
+ $rightrolesMapper = new Application_Model_RightRolesMapper();
+ $rightroles = $rightrolesMapper->find($roleid, $rightid);
+
+ $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ $xml .= "<xml>\n";
+ $xml .= "\t<checkright>\n";
+
+ if(is_object($rightroles)) {
+ $xml .= "\t\t</success>true</success>\n";
+ } else {
+ $xml .= "\t\t</success>false</success>\n";
+ }
+
+ $xml .= "\t</checkright>\n";
+ $xml .= "</xml>";
+
+ header('Content-Type: text/xml');
+ header('Content-Disposition: inline; filename="group.xml"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+ echo $xml;
+
+ }
+
public function loginAction() {
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$xml .= "<xml>\n";