summaryrefslogtreecommitdiffstats
path: root/external
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-08-02 14:34:08 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-08-02 14:34:08 +0200
commit27c7c7773eaaa0aa15fbf5bffeee501941d0d339 (patch)
tree18b1bcdb4e3d06c509d519cdb1865a626190c930 /external
parent3b3b5b9033b060bc8428a397b34ccb2cad0d8307 (diff)
add api for updating feeds with a seperate cron job, #301
Diffstat (limited to 'external')
-rw-r--r--external/feedapi.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/external/feedapi.php b/external/feedapi.php
index cc9753eb5..fdb83e682 100644
--- a/external/feedapi.php
+++ b/external/feedapi.php
@@ -182,4 +182,47 @@ class FeedAPI extends Controller {
}
+ /**
+ * @IsAdminExemption
+ * @IsSubAdminExemption
+ * @CSRFExemption
+ * @Ajax
+ * @API
+ */
+ public function getAllFromAllUsers() {
+ $feeds = $this->feedBusinessLayer->findAllFromAllUsers();
+ $result = array('feeds' => array());
+
+ foreach ($feeds as $feed) {
+ array_push($result['feeds'], array(
+ 'id' => $feed->getId(),
+ 'userId' => $feed->getUserId()
+ ));
+ }
+
+ return new JSONResponse($result);
+ }
+
+
+ /**
+ * @IsAdminExemption
+ * @IsSubAdminExemption
+ * @CSRFExemption
+ * @Ajax
+ * @API
+ */
+ public function update() {
+ $userId = $this->params('userId');
+ $feedId = $this->params('feedId');
+
+ try {
+ $this->feedBusinessLayer->update($feedId, $userId);
+ } catch(BusinessLayerException $ex) {
+ return new JSONResponse(array('message' => $ex->getMessage()),
+ Http::STATUS_NOT_FOUND);
+ }
+
+ }
+
+
}