Author: arunpatidar Date: Sat Feb 20 12:35:31 2016 New Revision: 1731390 URL: http://svn.apache.org/viewvc?rev=1731390&view=rev Log: [OFBIZ-6909] Applied patch for adding a new fieled 'disabledBy' in UserLogin entity.Thanks Yashwant for reporting issue and patch.
Modified: ofbiz/trunk/framework/common/servicedef/services.xml ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java ofbiz/trunk/framework/security/entitydef/entitymodel.xml Modified: ofbiz/trunk/framework/common/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=1731390&r1=1731389&r2=1731390&view=diff ============================================================================== --- ofbiz/trunk/framework/common/servicedef/services.xml (original) +++ ofbiz/trunk/framework/common/servicedef/services.xml Sat Feb 20 12:35:31 2016 @@ -419,6 +419,7 @@ under the License. <attribute name="externalAuthId" type="String" mode="IN" optional="true"/> <attribute name="userLdapDn" type="String" mode="IN" optional="true"/> <attribute name="requirePasswordChange" type="String" mode="IN" optional="true"/> + <attribute name="disabledBy" type="String" mode="IN" optional="true"/> </service> <!-- common permission services --> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1731390&r1=1731389&r2=1731390&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Sat Feb 20 12:35:31 2016 @@ -186,13 +186,14 @@ public class LoginServices { boolean hasLoggedOut = userLogin.get("hasLoggedOut") != null ? "Y".equalsIgnoreCase(userLogin.getString("hasLoggedOut")) : false; - if (UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) || - (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) { + if ((UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) || + (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) && UtilValidate.isEmpty(userLogin.getString("disabledBy"))) { String successfulLogin; if (!isSystem) { userLogin.set("enabled", "Y"); + userLogin.set("disabledBy", null); } // attempt to authenticate with Authenticator class(es) @@ -895,6 +896,11 @@ public class LoginServices { // if was disabled and we are enabling it, clear disabledDateTime if (!wasEnabled && "Y".equals(context.get("enabled"))) { userLoginToUpdate.set("disabledDateTime", null); + userLoginToUpdate.set("disabledBy", null); + } + + if ("N".equals(context.get("enabled"))) { + userLoginToUpdate.set("disabledBy", loggedInUserLogin.getString("userLoginId")); } try { Modified: ofbiz/trunk/framework/security/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/entitydef/entitymodel.xml?rev=1731390&r1=1731389&r2=1731390&view=diff ============================================================================== --- ofbiz/trunk/framework/security/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/framework/security/entitydef/entitymodel.xml Sat Feb 20 12:35:31 2016 @@ -79,6 +79,7 @@ under the License. <field name="userLdapDn" type="id-vlong-ne"> <description>The user's LDAP Distinguished Name - used for LDAP authentication</description> </field> + <field name="disabledBy" type="id-vlong"></field> <prim-key field="userLoginId"/> </entity> <entity entity-name="UserLoginPasswordHistory"