incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r825203 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/RestAPI.scala
Date Wed, 14 Oct 2009 17:24:35 GMT
Author: vdichev
Date: Wed Oct 14 17:24:35 2009
New Revision: 825203

URL: http://svn.apache.org/viewvc?rev=825203&view=rev
Log:
RESTful API to list pools.

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/RestAPI.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/RestAPI.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/RestAPI.scala?rev=825203&r1=825202&r2=825203&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/RestAPI.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/RestAPI.scala Wed Oct 14
17:24:35 2009
@@ -103,6 +103,9 @@
 
     case Req("api" :: "add_user_pool" :: Nil, "", PostRequest) =>
       addUserToPool
+
+    case Req("api" :: "get_pools" :: Nil, "", GetRequest) =>
+      getPools
   }
 
   def findAction: Box[Action] =
@@ -388,6 +391,16 @@
     r
   }
   
+  def getPools(): LiftResponse = {
+    val ret: Box[NodeSeq] =
+    for (user <- User.currentUser ?~ "Not logged in")
+    yield AccessPool.findAll(In(AccessPool.id, Privilege.pool, By(Privilege.user, user)),
+                             OrderBy(AccessPool.id, Descending),
+                             MaxRows(20)).
+          flatMap(_.toXml)
+    ret
+  }
+
   def createTag(in: NodeSeq) = <esme_api>{in}</esme_api>
 
   



Mime
View raw message