directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1538890 - in /directory/escimo/trunk: ldap/src/main/java/org/apache/directory/scim/ldap/ server/src/main/java/org/apache/directory/scim/rest/
Date Tue, 05 Nov 2013 07:34:48 GMT
Author: kayyagari
Date: Tue Nov  5 07:34:48 2013
New Revision: 1538890

URL: http://svn.apache.org/r1538890
Log:
allow searching groups

Modified:
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
    directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/GroupService.java
    directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java?rev=1538890&r1=1538889&r2=1538890&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
Tue Nov  5 07:34:48 2013
@@ -299,7 +299,8 @@ public class LdapResourceProvider implem
         
         String path = ctx.getUriInfo().getPath();
         String uri = ScimUtil.CORE_USER_URI;
-        if( path.endsWith( "/Groups" ) )
+        
+        if( path.endsWith( "Groups" ) || path.endsWith( "Groups/" ) )
         {
             uri = ScimUtil.CORE_GROUP_URI;
         }

Modified: directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/GroupService.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/GroupService.java?rev=1538890&r1=1538889&r2=1538890&view=diff
==============================================================================
--- directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/GroupService.java
(original)
+++ directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/GroupService.java
Tue Nov  5 07:34:48 2013
@@ -31,6 +31,7 @@ import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -41,6 +42,7 @@ import javax.ws.rs.core.UriInfo;
 
 import org.apache.directory.scim.AttributeNotFoundException;
 import org.apache.directory.scim.GroupResource;
+import org.apache.directory.scim.ListResponse;
 import org.apache.directory.scim.ProviderService;
 import org.apache.directory.scim.RequestContext;
 import org.apache.directory.scim.ResourceNotFoundException;
@@ -212,4 +214,35 @@ public class GroupService
         return rb.build();
     }
 
+    @GET
+    @Produces({MediaType.APPLICATION_JSON})
+    public Response search( @QueryParam("filter") String filter, @QueryParam("attributes")
String attributes, @Context UriInfo uriInfo, @Context HttpHeaders headers )
+    {
+        ResponseBuilder rb = null;
+
+        if( ( ( filter == null ) || ( filter.trim().length() == 0 ) ) &&
+            ( ( attributes == null ) || ( attributes.trim().length() == 0 ) ) )
+        {
+            return sendBadRequest( "Neither filter nor attributes parameter is present with
the call to " + uriInfo.getAbsolutePath() );
+        }
+        
+        LOG.debug( "Filter : {}", filter );
+        LOG.debug( "Attributes : {}", attributes );
+    
+        try
+        {
+            RequestContext ctx = new RequestContext( provider, uriInfo, headers );
+            ListResponse lr = provider.search( filter, attributes, ctx );
+
+            String json = ResourceSerializer.serialize( lr );
+            rb = Response.ok().entity( json );
+        }
+        catch( Exception e )
+        {
+            rb = buildError( e );
+        }
+
+        return rb.build();
+    }
+
 }

Modified: directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java?rev=1538890&r1=1538889&r2=1538890&view=diff
==============================================================================
--- directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
(original)
+++ directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
Tue Nov  5 07:34:48 2013
@@ -227,7 +227,7 @@ public class UserService
         if( ( ( filter == null ) || ( filter.trim().length() == 0 ) ) &&
             ( ( attributes == null ) || ( attributes.trim().length() == 0 ) ) )
         {
-            return sendBadRequest( "Neither filter nor attributes parameters are present
with the call to " + uriInfo.getAbsolutePath() );
+            return sendBadRequest( "Neither filter nor attributes parameter is present with
the call to " + uriInfo.getAbsolutePath() );
         }
         
         LOG.debug( "Filter : {}", filter );



Mime
View raw message