svn commit: r580116 - in /lenya/trunk/src: java/org/apache/lenya/ac/ modules-core/ac/java/src/org/apache/lenya/ac/impl/ modules-core/administration/usecases/ modules-core/ldap/java/src/org/apache/lenya/ac/ldap/

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: rfrovarp
Date: Thu Sep 27 11:02:21 2007
New Revision: 580116

URL: http://svn.apache.org/viewvc?rev=580116&view=rev
Log:
No sense in displaying change password button if it won't do anything as it will only confuse users.

Modified:
    lenya/trunk/src/java/org/apache/lenya/ac/User.java
    lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java
    lenya/trunk/src/modules-core/administration/usecases/user.jx
    lenya/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java

Modified: lenya/trunk/src/java/org/apache/lenya/ac/User.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/ac/User.java?rev=580116&r1=580115&r2=580116&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/ac/User.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/ac/User.java Thu Sep 27 11:02:21 2007
@@ -43,7 +43,13 @@
      * @param plainTextPassword The plain text password.
      */
     void setPassword(String plainTextPassword);
-    
+   
+    /**
+     * Checks support for changing password
+     * @return true if password change is supported
+     */
+    public abstract boolean canChangePassword();
+ 
     /**
      * Returns the user's preferred locale for the Lenya
      * CMS menus and CMS screens.
@@ -116,4 +122,4 @@
      * @return The accreditable manager this accreditable belongs to.
      */
     AccreditableManager getAccreditableManager();
-}
\ No newline at end of file
+}

Modified: lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java?rev=580116&r1=580115&r2=580116&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java (original)
+++ lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/AbstractUser.java Thu Sep 27 11:02:21 2007
@@ -105,6 +105,14 @@
     }
 
     /**
+     * Checks support for changing password
+     * @return true if password change is supported
+     */
+    public boolean canChangePassword() {
+        return true;
+    }
+
+    /**
      * @return Returns the defaultDocumentLocale.
      */
     public String getDefaultDocumentLocale() {
@@ -160,4 +168,4 @@
         return this.encryptedPassword.equals(Password.encrypt(password));
     }
 
-}
\ No newline at end of file
+}

Modified: lenya/trunk/src/modules-core/administration/usecases/user.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/administration/usecases/user.jx?rev=580116&r1=580115&r2=580116&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/administration/usecases/user.jx (original)
+++ lenya/trunk/src/modules-core/administration/usecases/user.jx Thu Sep 27 11:02:21 2007
@@ -84,18 +84,20 @@
                 </form>
               </td>
             </tr>
-            
-            <tr>
-              <td/>
-              <td>
-                <form id="form-change_user_password">
-                  <input type="hidden" name="lenya.usecase" value="admin.changePasswordAdmin"/>
-                  <input type="hidden" name="userId" value="${user.getId()}"/>
-                  <input i18n:attr="value" type="submit" value="Change Password" name="input-change_user_password"/>
-                </form>
-              </td>
-            </tr>
-            
+
+            <jx:if test="${user.canChangePassword() == 'true'}"> 
+              <tr>
+                <td/>
+                <td>
+                  <form id="form-change_user_password">
+                    <input type="hidden" name="lenya.usecase" value="admin.changePasswordAdmin"/>
+                    <input type="hidden" name="userId" value="${user.getId()}"/>
+                    <input i18n:attr="value" type="submit" value="Change Password" name="input-change_user_password"/>
+                  </form>
+                </td>
+              </tr>
+            </jx:if>
+          
             <tr>
               <td class="lenya-entry-caption"><i18n:text>Groups</i18n:text>:</td>
               <td>

Modified: lenya/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java?rev=580116&r1=580115&r2=580116&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java (original)
+++ lenya/trunk/src/modules-core/ldap/java/src/org/apache/lenya/ac/ldap/LDAPUser.java Thu Sep 27 11:02:21 2007
@@ -311,6 +311,14 @@
     }
 
     /**
+     * The LDAPUser doesn't change any passwords as they are handled by LDAP
+     * @return always returns false
+     */
+    public boolean canChangePassword() {
+        return false;
+    }
+
+    /**
      * Connect to the LDAP server
      * @param principal the principal string for the LDAP connection
      * @param credentials the credentials for the LDAP connection
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.