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=757078&r1=757077&r2=757078&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 Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -77,7 +77,7 @@ } } } - + Map<String, Object> result = FastMap.newInstance(); GenericDelegator delegator = ctx.getDelegator(); boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt")); @@ -122,7 +122,7 @@ String encodedPassword = useEncryption ? HashCrypt.getDigestHash(password, getHashType()) : password; String encodedPasswordOldFunnyHexEncode = useEncryption ? HashCrypt.getDigestHashOldFunnyHexEncode(password, getHashType()) : password; String encodedPasswordUsingDbHashType = encodedPassword; - + String currentPassword = userLogin.getString("currentPassword"); if (useEncryption && currentPassword != null && currentPassword.startsWith("{")) { // get encode according to the type in the database @@ -131,7 +131,7 @@ encodedPasswordUsingDbHashType = HashCrypt.getDigestHash(password, dbHashType); } } - + String ldmStr = UtilProperties.getPropertyValue("security.properties", "login.disable.minutes"); long loginDisableMinutes = 30; @@ -188,7 +188,7 @@ Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); if (currentFailedLogins != null && currentFailedLogins.longValue() > 0) { userLogin.set("successiveFailedLogins", Long.valueOf(0)); - } else if (!hasLoggedOut) { + } else if (!hasLoggedOut) { // successful login & no loggout flag, no need to change anything, so don't do the store doStore = false; } @@ -210,7 +210,7 @@ result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); } else { Debug.logInfo("Entered password [" + encodedPassword + "], Entered password OldFunnyHexEncode [" + encodedPasswordOldFunnyHexEncode + "], db password [" + userLogin.getString("currentPassword") + "]", module); - + // password is incorrect, but this may be the result of a stale cache entry, // so lets clear the cache and try again if this is the first pass if (isServiceAuth && passNumber <= 1) { @@ -262,37 +262,37 @@ parentTx = TransactionUtil.suspend(); } catch (GenericTransactionException e) { Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); - } + } try { beganTransaction = TransactionUtil.begin(); - + if (doStore) { userLogin.store(); } - + if ("true".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history"))) { boolean createHistory = true; - + // only save info on service auth if option set to true to do so if (isServiceAuth && !"true".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history.on.service.auth"))) { createHistory = false; } - + if (createHistory) { Map<String, Object> ulhCreateMap = UtilMisc.toMap("userLoginId", username, "visitId", visitId, "fromDate", UtilDateTime.nowTimestamp(), "successfulLogin", successfulLogin); - + ModelEntity modelUserLogin = userLogin.getModelEntity(); if (modelUserLogin.isField("partyId")) { ulhCreateMap.put("partyId", userLogin.get("partyId")); } - + // ONLY save the password if it was incorrect if ("N".equals(successfulLogin) && !"false".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history.incorrect.password"))) { ulhCreateMap.put("passwordUsed", password); } - + //Debug.logInfo(new Exception(), "=================== Creating new UserLoginHistory at " + UtilDateTime.nowTimestamp(), module); delegator.create("UserLoginHistory", ulhCreateMap); } @@ -308,7 +308,7 @@ } catch (GenericTransactionException e2) { Debug.logError(e2, "Could not rollback nested transaction: " + e2.getMessage(), module); } - + // if doStore is true then this error should not be ignored and we shouldn't consider it a successful login if this happens as there is something very wrong lower down that will bite us again later if (doStore) { return ServiceUtil.returnError(geeErrMsg); @@ -370,7 +370,7 @@ } return result; } - + private static void createUserLoginPasswordHistory(GenericDelegator delegator,String userLoginId, String currentPassword) throws GenericEntityException{ int passwordChangeHistoryLimit = 0; try { @@ -383,7 +383,7 @@ // Not saving password history, so return from here. return; } - + EntityFindOptions efo = new EntityFindOptions(); efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE); EntityListIterator eli = delegator.find("UserLoginPasswordHistory", EntityCondition.makeConditionMap("userLoginId", userLoginId), null, null, UtilMisc.toList("-fromDate"), efo); @@ -403,14 +403,14 @@ } } eli.close(); - - // save this password in history + + // save this password in history GenericValue userLoginPwdHistToCreate = delegator.makeValue("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId", userLoginId,"fromDate", nowTimestamp)); boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt")); userLoginPwdHistToCreate.set("currentPassword", useEncryption ? HashCrypt.getDigestHash(currentPassword, getHashType()) : currentPassword); userLoginPwdHistToCreate.create(); } - + /** Creates a UserLogin *@param ctx The DispatchContext that this service is operating in *@param context Map containing the input parameters @@ -746,7 +746,7 @@ errMsg = UtilProperties.getMessage(resource,"loginservices.could_not_change_password_userlogin_with_id_not_exist", messageMap, locale); return ServiceUtil.returnError(errMsg); } - + boolean wasEnabled = !"N".equals(userLoginToUpdate.get("enabled")); if (context.containsKey("enabled")) { @@ -790,11 +790,11 @@ String errMsg = null; if (!ignoreCurrentPassword) { - + String encodedPassword = useEncryption ? HashCrypt.getDigestHash(currentPassword, getHashType()) : currentPassword; String encodedPasswordOldFunnyHexEncode = useEncryption ? HashCrypt.getDigestHashOldFunnyHexEncode(currentPassword, getHashType()) : currentPassword; String encodedPasswordUsingDbHashType = encodedPassword; - + String oldPassword = userLogin.getString("currentPassword"); if (useEncryption && oldPassword != null && oldPassword.startsWith("{")) { // get encode according to the type in the database @@ -846,7 +846,7 @@ String newPasswordHash = newPassword; if (useEncryption) { newPasswordHash = HashCrypt.getDigestHash(newPassword, getHashType()); - } + } try { List<GenericValue> pwdHistList = delegator.findByAnd("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId",userLogin.getString("userLoginId"),"currentPassword",newPasswordHash)); Debug.logInfo(" checkNewPassword pwdHistListpwdHistList " + pwdHistList.size(), module); @@ -861,7 +861,7 @@ Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.getMessage()); errMsg = UtilProperties.getMessage(resource,"loginevents.error_accessing_password_change_history", messageMap, locale); } - + } int minPasswordLength = 0; @@ -896,7 +896,7 @@ Debug.logWarning("Password encrypt hash type is not specified in security.properties, use SHA", module); hashType = "SHA"; } - + return hashType; } } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/olap/CommonDimensionServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -102,7 +102,7 @@ dateValue.set("dayOfMonth", new Long(calendar.get(Calendar.DAY_OF_MONTH))); dateValue.set("dayOfYear", new Long(calendar.get(Calendar.DAY_OF_YEAR))); dateValue.set("monthName", monthNameFormat.format(currentDate)); - + dateValue.set("monthOfYear", new Long(calendar.get(Calendar.MONTH) + 1)); dateValue.set("yearName", new Long(calendar.get(Calendar.YEAR))); dateValue.set("weekOfMonth", new Long(calendar.get(Calendar.WEEK_OF_MONTH))); @@ -110,7 +110,7 @@ dateValue.set("weekdayType", (dayOfWeek == 1 || dayOfWeek == 7? "Weekend": "Weekday")); dateValue.set("yearMonthDay", yearMonthDayFormat.format(currentDate)); dateValue.set("yearAndMonth", yearMonthFormat.format(currentDate)); - + try { if (newValue) { dateValue.create(); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -36,7 +36,7 @@ public class PeriodServices { public static String module = PeriodServices.class.getName(); - + /* find the date of the last closed CustomTimePeriod, or, if none available, the earliest date available of any * CustomTimePeriod */ @@ -45,16 +45,16 @@ String organizationPartyId = (String) context.get("organizationPartyId"); // input parameters String periodTypeId = (String) context.get("periodTypeId"); Timestamp findDate = (Timestamp) context.get("findDate"); - + // default findDate to now if (findDate == null) { findDate = UtilDateTime.nowTimestamp(); } - + Timestamp lastClosedDate = null; // return parameters GenericValue lastClosedTimePeriod = null; Map<String, Object> result = ServiceUtil.returnSuccess(); - + try { // try to get the ending date of the most recent accounting time period before findDate which has been closed List<EntityCondition> findClosedConditions = UtilMisc.toList(EntityCondition.makeConditionMap("organizationPartyId", organizationPartyId), @@ -64,8 +64,8 @@ // if a periodTypeId was supplied, use it findClosedConditions.add(EntityCondition.makeConditionMap("periodTypeId", periodTypeId)); } - List<GenericValue> closedTimePeriods = delegator.findList("CustomTimePeriod", EntityCondition.makeCondition(findClosedConditions), - UtilMisc.toSet("customTimePeriodId", "periodTypeId", "isClosed", "fromDate", "thruDate"), + List<GenericValue> closedTimePeriods = delegator.findList("CustomTimePeriod", EntityCondition.makeCondition(findClosedConditions), + UtilMisc.toSet("customTimePeriodId", "periodTypeId", "isClosed", "fromDate", "thruDate"), UtilMisc.toList("thruDate DESC"), null, false); if ((closedTimePeriods != null) && (closedTimePeriods.size() > 0) && (closedTimePeriods.get(0).get("thruDate") != null)) { @@ -78,14 +78,14 @@ if ((periodTypeId != null) && !(periodTypeId.equals(""))) { findParams.put("periodTypeId", periodTypeId); } - List<GenericValue> timePeriods = delegator.findByAnd("CustomTimePeriod", findParams, UtilMisc.toList("fromDate ASC")); + List<GenericValue> timePeriods = delegator.findByAnd("CustomTimePeriod", findParams, UtilMisc.toList("fromDate ASC")); if ((timePeriods != null) && (timePeriods.size() > 0) && (timePeriods.get(0).get("fromDate") != null)) { lastClosedDate = UtilDateTime.toTimestamp(timePeriods.get(0).getDate("fromDate")); } else { return ServiceUtil.returnError("Cannot get a starting date for net income"); } } - + result.put("lastClosedTimePeriod", lastClosedTimePeriod); // ok if this is null - no time periods have been closed result.put("lastClosedDate", lastClosedDate); // should have a value - not null return result; Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/period/PeriodWorker.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -31,7 +31,7 @@ public class PeriodWorker { public static String module = PeriodWorker.class.getName(); - + /** * Method to get a condition that checks that the given fieldName is in a given timePeriod. */ Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceWorker.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceWorker.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/preferences/PreferenceWorker.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -84,7 +84,7 @@ boolean hasPermission = false; GenericValue userLogin = (GenericValue) context.get("userLogin"); if (userLogin != null) { - String userLoginId = userLogin.getString("userLoginId"); + String userLoginId = userLogin.getString("userLoginId"); String userLoginIdArg = (String) context.get(LOGINID_PARAMETER_NAME); // is an optional parameters which defaults to the logged on user if (userLoginIdArg == null || (userLoginIdArg != null && userLoginId.equals(userLoginIdArg))) { hasPermission = true; // users can copy to their own preferences @@ -99,7 +99,7 @@ } /** - * Checks preference get/set permissions. Returns hasPermission=true if + * Checks preference get/set permissions. Returns hasPermission=true if * permission is granted. * <p>This method is a simple wrapper around the isValidxxxId methods.</p> * @param ctx The DispatchContext that this service is operating in. @@ -157,7 +157,7 @@ * found, the method attempts to get the current user's userLoginId. If the user * isn't logged in, then the method returns <a href="#DEFAULT_UID">DEFAULT_UID</a> * if returnDefault is set to true, otherwise the method returns a null or empty string.</p> - * + * * @param context Map containing the input arguments. * @param returnDefault return <a href="#DEFAULT_UID">DEFAULT_UID</a> if no userLoginId is found. * @return userLoginId String @@ -189,7 +189,7 @@ * If the user has the <a href="#ADMIN_PERMISSION">ADMIN_PERMISSION</a> permission then the * method returns true.</li> * </ul></p> - * + * * @param ctx The DispatchContext that this service is operating in. * @param context Map containing the input arguments. * @return true if the userLoginId arguments are valid Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -37,16 +37,16 @@ * StatusServices */ public class StatusServices { - + public static final String module = StatusServices.class.getName(); - + public static Map<String, Object> getStatusItems(DispatchContext ctx, Map<String, ?> context) { GenericDelegator delegator = ctx.getDelegator(); List<String> statusTypes = checkList(context.get("statusTypeIds"), String.class); if (statusTypes == null || statusTypes.size() == 0) { return ServiceUtil.returnError("Parameter statusTypeIds can not be null and must contain at least one element"); } - + List<GenericValue> statusItems = FastList.newInstance(); for (String statusTypeId: statusTypes) { try { @@ -55,7 +55,7 @@ } catch (GenericEntityException e) { Debug.logError(e, module); } - } + } Map<String, Object> ret = FastMap.newInstance(); ret.put("statusItems",statusItems); return ret; @@ -74,6 +74,6 @@ if (statusValidChangeToDetails != null) { ret.put("statusValidChangeToDetails", statusValidChangeToDetails); } - return ret; + return ret; } } Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusWorker.java Sat Mar 21 23:25:08 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -34,9 +34,9 @@ * StatusWorker */ public class StatusWorker { - + public static final String module = StatusWorker.class.getName(); - + public static void getStatusItems(PageContext pageContext, String attributeName, String statusTypeId) { GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator"); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java?rev=757078&r1=757077&r2=757078&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java Sat Mar 21 23:25:08 2009 @@ -81,5 +81,5 @@ public static Calendar addUomTime(Timestamp startTime, String uomId, int value) { return addUomTime(null, startTime, uomId, value); - } + } } |
Free forum by Nabble | Edit this page |