usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [22/50] [abbrv] usergrid git commit: USERGRID-1188: return error rather than 204 when email not provided for user creation
Date Thu, 04 Feb 2016 17:57:46 GMT
USERGRID-1188: return error rather than 204 when email not provided for user creation


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/0d4c35fa
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/0d4c35fa
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/0d4c35fa

Branch: refs/heads/asf-site
Commit: 0d4c35fa7bded5eecd99501ea6d4f660274fc265
Parents: f5d0153
Author: Mike Dunker <mdunker@apigee.com>
Authored: Fri Jan 29 11:24:30 2016 -0800
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Fri Jan 29 11:24:30 2016 -0800

----------------------------------------------------------------------
 .../apache/usergrid/rest/management/users/UsersResource.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/0d4c35fa/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
index 6658227..640a6c2 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
@@ -122,7 +122,13 @@ public class UsersResource extends AbstractContextResource {
                     properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) );
         }
 
-        logger.info( "Create user: " + username );
+        // email is only required parameter
+        if (StringUtils.isBlank(email)) {
+            throw new IllegalArgumentException( "email form parameter is required" );
+        }
+
+        // if username not provided, email will be used
+        logger.info( "Create user: {}", (StringUtils.isNotBlank(username) ? username : email)
);
 
         ApiResponse response = createApiResponse();
         response.setAction( "create user" );


Mime
View raw message