usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [6/9] incubator-usergrid git commit: Fixes from code review.
Date Thu, 16 Apr 2015 18:09:30 GMT
Fixes from code review.


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

Branch: refs/heads/master
Commit: 96ef88f691ae8b73dc7918c9adc96e4410790d40
Parents: f252547
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Thu Apr 16 09:38:30 2015 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Thu Apr 16 09:38:30 2015 -0400

----------------------------------------------------------------------
 .../rest/management/ManagementResource.java        | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/96ef88f6/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
index 1bae8eb..73963fe 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
@@ -201,9 +201,9 @@ public class ManagementResource extends AbstractContextResource {
                                              String callback, boolean loadAdminData ) throws
Exception {
 
 
-        // if external tokens are enabled for Usegrid central authentication,
-        // then only the superuser can login via this Usergrid instance.
-        if ( externalTokensEnabled && !username.equalsIgnoreCase( superuserName ))
{
+        // when external tokens (Usergrid Central SSO) are enabled only superuser can login
as Admin User.
+        if ( externalTokensEnabled &&
+                superuserAllowed && !username.equalsIgnoreCase( superuserName ))
{
 
             // cause an HTTP 400 response with a useful message
             throw  new IllegalArgumentException("Admin Users must login via " +
@@ -583,17 +583,16 @@ public class ManagementResource extends AbstractContextResource {
 
         // if user does not exist locally then we need to fix that
 
-        UUID userId = null;
-        final OrganizationInfo organizationInfo = management.getOrganizationByName(username);
+        UUID userId = management.getAdminUserByUsername( username ).getUuid();
 
-        if ( organizationInfo == null ) {
+        if ( userId == null ) {
 
-            // create local user and personal organization, activate user.
+            // create local user and and organizations they have on the central Usergrid
instance
 
             String name     = userNode.get( "name" ).getTextValue();
             String email    = userNode.get( "email" ).getTextValue();
 
-            // set dummy password to random string that nobody can guess, in SSO setup
+            // set dummy password to random string that nobody can guess, in central SSO
setup
             // admin users should never be able to login directly to this Usergrid system
             String dummyPassword = RandomStringUtils.randomAlphanumeric( 40 );
 
@@ -630,8 +629,6 @@ public class ManagementResource extends AbstractContextResource {
                 }
             }
 
-        } else {
-            userId = management.getAdminUserByUsername( username ).getUuid();
         }
 
         // store the external access_token as if it were one of our own


Mime
View raw message