portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1685202 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
Date Sat, 13 Jun 2015 00:43:28 GMT
Author: taylor
Date: Sat Jun 13 00:43:27 2015
New Revision: 1685202

URL: http://svn.apache.org/r1685202
Log:
JS2-1326: fixed bugs with Credential expiration processing in User Admin portlet

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java?rev=1685202&r1=1685201&r2=1685202&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
Sat Jun 13 00:43:27 2015
@@ -119,8 +119,7 @@ public class JetspeedPrincipalManagement
     public static final String NEW_USER_TEMPLATE_DIR = "newUserTemplateDirectory";
     public static final String SUB_SITE_ROOT = "subsiteRootFolder";
 
-    private static final java.sql.Date MAX_DATE = java.sql.Date
-            .valueOf("8099-01-01");
+    private static final java.sql.Date MAX_DATE = java.sql.Date.valueOf("2099-01-01");
 
     private String principalParam;
 
@@ -1081,11 +1080,26 @@ public class JetspeedPrincipalManagement
                         if (expiredFlagStr != null)
                         {
                             if (!passwordSet
-                                    && expiredFlagStr.equals("expired"))
+                                    && expiredFlagStr.equalsIgnoreCase("active"))
{
+                                credential.setExpirationDate(null);
+                                credential.setExpired(false);
+                                getServiceLocator()
+                                        .getAuditActivity()
+                                        .logAdminCredentialActivity(
+                                                getPortletRequest()
+                                                        .getUserPrincipal()
+                                                        .getName(),
+                                                getIPAddress(),
+                                                getPrincipal().getName(),
+                                                AuditActivity.PASSWORD_ENABLED,
+                                                AdminPortletWebPage.USER_ADMINISTRATION);
+                            }
+                            else if (!passwordSet
+                                    && expiredFlagStr.equalsIgnoreCase("expired"))
                             {
-                                java.sql.Date today = new java.sql.Date(
-                                        new Date().getTime());
+                                java.sql.Date today = new java.sql.Date(new Date().getTime());
                                 credential.setExpirationDate(today);
+                                credential.setExpired(true);
                                 getServiceLocator()
                                         .getAuditActivity()
                                         .logAdminCredentialActivity(
@@ -1096,12 +1110,11 @@ public class JetspeedPrincipalManagement
                                                 getPrincipal().getName(),
                                                 AuditActivity.PASSWORD_EXPIRE,
                                                 AdminPortletWebPage.USER_ADMINISTRATION);
-                            } else if (expiredFlagStr.equals("extend"))
+                            } else if (expiredFlagStr.equalsIgnoreCase("extend"))
                             {
-                                // getUserManager().setPasswordExpiration(getUserName(),
-                                // null);
-                                // TODO confirm with Ate/David
-                                credential.setExpirationDate(MAX_DATE);
+                                long oneWeekExtension = System.currentTimeMillis() + (86400L
* 7L * 1000L);
+                                credential.setExpirationDate(new java.sql.Date(oneWeekExtension));
+                                credential.setExpired(false);
                                 getServiceLocator()
                                         .getAuditActivity()
                                         .logAdminCredentialActivity(
@@ -1112,9 +1125,10 @@ public class JetspeedPrincipalManagement
                                                 getPrincipal().getName(),
                                                 AuditActivity.PASSWORD_EXTEND,
                                                 AdminPortletWebPage.USER_ADMINISTRATION);
-                            } else if (expiredFlagStr.equals("unlimited"))
+                            } else if (expiredFlagStr.equalsIgnoreCase("unlimited"))
                             {
                                 credential.setExpirationDate(MAX_DATE);
+                                credential.setExpired(false);
                                 getServiceLocator()
                                         .getAuditActivity()
                                         .logAdminCredentialActivity(
@@ -1276,8 +1290,8 @@ public class JetspeedPrincipalManagement
                 setLastAuthenticationDate(credential
                         .getLastAuthenticationDate());
                 setCredentialExpirationDate(credential.getExpirationDate());
-                setUserExpiredFlag(credential.isExpired() ? "expired"
-                        : "active");
+                setUserExpiredFlag(credential.isExpired() ? "Expired"
+                        : "Active");
             }
             catch (SecurityException secExp)
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message