Repository: usergrid Updated Branches: refs/heads/release-2.1.1 37bee320a -> 29e940e36
Oops. IntelliJ let me down ;-) Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/29e940e3 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/29e940e3 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/29e940e3 Branch: refs/heads/release-2.1.1 Commit: 29e940e365980e42a55cb5adad9223cc53f4e9ba Parents: 37bee32 Author: Dave Johnson <snoopd...@apache.org> Authored: Thu May 5 12:26:56 2016 -0400 Committer: Dave Johnson <snoopd...@apache.org> Committed: Thu May 5 12:26:56 2016 -0400 ---------------------------------------------------------------------- .../organizations/OrganizationsResource.java | 18 ++++------------- .../rest/management/users/UserResource.java | 21 ++++++++++---------- .../rest/management/users/UsersResource.java | 6 +++--- .../rest/management/ManagementResourceIT.java | 2 +- 4 files changed, 19 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/29e940e3/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java index 0348c01..360e660 100644 --- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java +++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java @@ -24,14 +24,10 @@ import org.apache.usergrid.management.ApplicationCreator; import org.apache.usergrid.management.OrganizationInfo; import org.apache.usergrid.management.OrganizationOwnerInfo; import org.apache.usergrid.management.exceptions.ManagementException; -import org.apache.usergrid.persistence.index.query.Identifier; import org.apache.usergrid.rest.AbstractContextResource; import org.apache.usergrid.rest.ApiResponse; import org.apache.usergrid.rest.RootResource; -import org.apache.usergrid.rest.management.ManagementResource; -import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess; import org.apache.usergrid.rest.security.annotations.RequireSystemAccess; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -42,15 +38,9 @@ import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; +import java.util.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException; -import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isPermittedAccessToOrganization; +import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_CENTRAL_URL; @Component( "org.apache.usergrid.rest.management.organizations.OrganizationsResource" ) @@ -196,11 +186,11 @@ public class OrganizationsResource extends AbstractContextResource { Map<String, Object> orgProperties, String callback ) throws Exception { final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Organization / Admin Users must be created via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } Preconditions http://git-wip-us.apache.org/repos/asf/usergrid/blob/29e940e3/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java index 7ca6418..ce79adf 100644 --- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java +++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java @@ -47,6 +47,7 @@ import java.util.UUID; import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isServiceAdmin; import static org.apache.usergrid.utils.ConversionUtils.string; +import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_CENTRAL_URL; @Component( "org.apache.usergrid.rest.management.users.UserResource" ) @@ -207,11 +208,11 @@ public class UserResource extends AbstractContextResource { public Viewable showPasswordResetForm( @Context UriInfo ui, @QueryParam( "token" ) String token ) { final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must reset passwords via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } UUID organizationId = null; @@ -254,11 +255,11 @@ public class UserResource extends AbstractContextResource { } final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must reset passwords via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } UUID organizationId = null; @@ -343,11 +344,11 @@ public class UserResource extends AbstractContextResource { public Viewable activate( @Context UriInfo ui, @QueryParam( "token" ) String token ) { final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must activate via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } UUID organizationId = null; @@ -376,11 +377,11 @@ public class UserResource extends AbstractContextResource { public Viewable confirm( @Context UriInfo ui, @QueryParam( "token" ) String token ) { final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must confirm via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } UUID organizationId = null; @@ -415,11 +416,11 @@ public class UserResource extends AbstractContextResource { throws Exception { final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must reactivate via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } logger.info( "Send activation email for user: {}" , user.getUuid() ); http://git-wip-us.apache.org/repos/asf/usergrid/blob/29e940e3/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 a997e18..e57e5ef 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 @@ -28,7 +28,6 @@ import org.apache.usergrid.rest.ApiResponse; import org.apache.usergrid.rest.RootResource; import org.apache.usergrid.rest.exceptions.AuthErrorInfo; import org.apache.usergrid.rest.exceptions.RedirectionException; -import org.apache.usergrid.rest.management.ManagementResource; import org.apache.usergrid.security.shiro.utils.SubjectUtils; import org.glassfish.jersey.server.mvc.Viewable; import org.slf4j.Logger; @@ -45,6 +44,7 @@ import java.util.UUID; import static org.apache.commons.lang.StringUtils.isBlank; import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException; +import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_CENTRAL_URL; @Component( "org.apache.usergrid.rest.management.users.UsersResource" ) @@ -115,11 +115,11 @@ public class UsersResource extends AbstractContextResource { throws Exception { final boolean externalTokensEnabled = - !StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + !StringUtils.isEmpty( properties.getProperty( USERGRID_CENTRAL_URL ) ); if ( externalTokensEnabled ) { throw new IllegalArgumentException( "Admin Users must signup via " + - properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) ); + properties.getProperty( USERGRID_CENTRAL_URL ) ); } // email is only required parameter http://git-wip-us.apache.org/repos/asf/usergrid/blob/29e940e3/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java index f05d4b6..6bf9117 100644 --- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java +++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java @@ -37,7 +37,7 @@ import javax.ws.rs.core.Response; import java.io.IOException; import java.util.*; -import static org.apache.usergrid.rest.management.ManagementResource.USERGRID_CENTRAL_URL; +import static org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl.USERGRID_CENTRAL_URL; import static org.apache.usergrid.utils.MapUtils.hashMap; import static org.junit.Assert.*;