You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/12/09 21:18:03 UTC
usergrid git commit: Added additional org debugging to help see how
is really missing all of their orgs and who is only missing one.
Repository: usergrid
Updated Branches:
refs/heads/unique_index_logging a212ff0df -> 477335372
Added additional org debugging to help see how is really missing all of their orgs and who is only missing one.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/47733537
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/47733537
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/47733537
Branch: refs/heads/unique_index_logging
Commit: 4773353721defac78cf241d18b38722f539c7e36
Parents: a212ff0
Author: George Reyes <gr...@apache.org>
Authored: Wed Dec 9 12:18:00 2015 -0800
Committer: George Reyes <gr...@apache.org>
Committed: Wed Dec 9 12:18:00 2015 -0800
----------------------------------------------------------------------
.../usergrid/tools/ManagementUserAudit.java | 40 ++++++++++++++++----
1 file changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/47733537/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java b/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
index 710fca1..8d4d0b1 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ManagementUserAudit.java
@@ -21,6 +21,7 @@ import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
import org.slf4j.Logger;
@@ -275,14 +276,16 @@ public class ManagementUserAudit extends ToolBase {
em.getCollection( new SimpleEntityRef( User.ENTITY_TYPE, userInfo.getUuid() ), "groups", null, 10000, Results.Level.REFS,
false );
- for ( EntityRef orgRef : orgResults.getRefs() ) {
- try {
- em.getDictionaryAsMap( orgRef, "orgProperties" );
- logger.info( "The following email works: {}",uniqueValue );
- }
- catch(EntityNotFoundException enfe){
- logger.error("Management user with email: {} is present but cannot login due to not finding the following organization: {}",uniqueValue,orgRef.getUuid());
- break;
+ if(orgResults.getRefs().size() == 1){
+ EntityRef orgRef = orgResults.getRef();
+ orgVerification( uniqueValue, em, orgRef, orgRef.getUuid(),
+ "Management user with email: {} is present but cannot login due to missing their only organization: {}" );
+ }
+ else {
+ for ( EntityRef orgRef : orgResults.getRefs() ) {
+ orgVerification( uniqueValue, em, orgRef, orgRef.getUuid(),
+ "Management user with email: {} is present with multiple orgs but is missing the following orgUUID: {}" );
+
}
}
}
@@ -290,6 +293,27 @@ public class ManagementUserAudit extends ToolBase {
}
+ private void orgVerification( final String uniqueValue, final EntityManager em, final EntityRef orgRef,
+ final UUID uuid, final String s2 ) throws Exception {
+ try {
+ em.getDictionaryAsMap( orgRef, "orgProperties" );
+ OrganizationInfo organizationInfo = managementService.getOrganizationByUuid( uuid );
+
+ Object[] loggingObject = new Object[3];
+ loggingObject[0] = uniqueValue;
+ loggingObject[1] = organizationInfo.getName();
+ loggingObject[2] = organizationInfo.getUuid();
+ //OrganizationInfo orgInfo = new OrganizationInfo(orgProperties.getProperties() );
+
+ logger.info( "The following email works: {} with the following orgname: {} and orgUUID: {}",
+ loggingObject );
+ }
+ catch ( EntityNotFoundException enfe ) {
+ logger.error( s2, uniqueValue, uuid );
+ }
+ }
+
+
//really only deletes ones that aren't existant for a specific value
private void deleteInvalidValuesForUniqueProperty( Mutator<ByteBuffer> m, CommandLine line ) throws Exception {
UUID applicationId = MANAGEMENT_APPLICATION_ID;