]> source.dussan.org Git - archiva.git/commitdiff
user now track userManagerImpl id they come from
authorOlivier Lamy <olamy@apache.org>
Sat, 8 Dec 2012 17:40:08 +0000 (17:40 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 8 Dec 2012 17:40:08 +0000 (17:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1418716 13f79535-47bb-0310-9956-ffa450edef68

redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/LdapUser.java
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/User.java
redback-users/redback-users-api/src/main/java/org/apache/archiva/redback/users/User.java
redback-users/redback-users-providers/redback-users-jdo/src/main/mdo/user.mdo
redback-users/redback-users-providers/redback-users-memory/src/main/java/org/apache/archiva/redback/users/memory/SimpleUser.java

index 2077261e81122e5925434a593cf30614e88e349a..1fe82a8fa8db0095cb39bc05bfb44e869bca79d0 100644 (file)
@@ -63,6 +63,11 @@ public class LdapUser
 
     private Attributes originalAttributes;
 
+    /**
+     * @since 2.1
+     */
+    private String userManagerId = "ldap";
+
     public LdapUser( String username )
     {
         this.username = username;
@@ -239,4 +244,9 @@ public class LdapUser
         this.originalAttributes = originalAttributes;
     }
 
+    public String getUserManagerId()
+    {
+        return userManagerId;
+    }
+
 }
index a944047b5e8a1cb7bc86ce70eab5338883b98d0e..6ebcca0ab16db79971011a65cbc724a677d3e961 100644 (file)
@@ -70,10 +70,17 @@ public class User
 
     /**
      * with some userManagerImpl it's not possible to edit users;
-     * @since 1.4-M4
+     * @since 2.1
      */
     private boolean readOnly;
 
+    /**
+     * as we can user multiple userManagers implementation we must track from which one this one comes.
+     * @since 2.1
+     * @return userManager id
+     */
+    private String userManagerId;
+
     public User()
     {
         // no op
@@ -255,28 +262,37 @@ public class User
         this.readOnly = readOnly;
     }
 
+    public String getUserManagerId()
+    {
+        return userManagerId;
+    }
+
+    public void setUserManagerId( String userManagerId )
+    {
+        this.userManagerId = userManagerId;
+    }
+
     @Override
     public String toString()
     {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "User" );
-        sb.append( "{username='" ).append( username ).append( '\'' );
-        sb.append( ", fullName='" ).append( fullName ).append( '\'' );
-        sb.append( ", email='" ).append( email ).append( '\'' );
-        sb.append( ", validated=" ).append( validated );
-        sb.append( ", locked=" ).append( locked );
-        sb.append( ", password='" ).append( password ).append( '\'' );
-        sb.append( ", passwordChangeRequired=" ).append( passwordChangeRequired );
-        sb.append( ", permanent=" ).append( permanent );
-        sb.append( ", confirmPassword='" ).append( confirmPassword ).append( '\'' );
-        sb.append( ", timestampAccountCreation='" ).append( timestampAccountCreation ).append( '\'' );
-        sb.append( ", timestampLastLogin='" ).append( timestampLastLogin ).append( '\'' );
-        sb.append( ", timestampLastPasswordChange='" ).append( timestampLastPasswordChange ).append( '\'' );
-        sb.append( ", previousPassword='" ).append( previousPassword ).append( '\'' );
-        sb.append( ", assignedRoles=" ).append( assignedRoles );
-        sb.append( ", readOnly=" ).append( readOnly );
-        sb.append( '}' );
-        return sb.toString();
+        return "User{" +
+            "username='" + username + '\'' +
+            ", fullName='" + fullName + '\'' +
+            ", email='" + email + '\'' +
+            ", validated=" + validated +
+            ", locked=" + locked +
+            //", password='" + password + '\'' +
+            ", passwordChangeRequired=" + passwordChangeRequired +
+            ", permanent=" + permanent +
+            ", confirmPassword='" + confirmPassword + '\'' +
+            ", timestampAccountCreation='" + timestampAccountCreation + '\'' +
+            ", timestampLastLogin='" + timestampLastLogin + '\'' +
+            ", timestampLastPasswordChange='" + timestampLastPasswordChange + '\'' +
+            ", previousPassword='" + previousPassword + '\'' +
+            ", assignedRoles=" + assignedRoles +
+            ", readOnly=" + readOnly +
+            ", userManagerId='" + userManagerId + '\'' +
+            '}';
     }
 
     @Override
index 6b96b6cd36706174142a44ca6da163df72eec53d..4d1d3db9d9f30d15715830a845fbfd390ead4d97 100644 (file)
@@ -292,4 +292,11 @@ public interface User
      */
     void setLastLoginDate( Date date );
 
+    /**
+     * as we can user multiple userManagers implementation we must track from which one this one comes.
+     * @since 2.1
+     * @return userManager id
+     */
+    String getUserManagerId();
+
 }
index 5a8c9a1fab18b26748ab43fdb25b6ad7f3cfced1..3390779c98a8b46940804e861693422d7f5f4029 100644 (file)
                  // Intentionally initialize List to avoid JPOX NullPointerException Issues.
                 previousEncodedPasswords = new java.util.ArrayList<String>();
               }
+              public String getUserManagerId()
+              {
+                return "jdo";
+              }
 
           ]]></code>
         </codeSegment>