Author: jleroux
Date: Sat Dec 15 04:56:27 2007
New Revision: 604423
URL: http://svn.apache.org/viewvc?rev=604423&view=rev
Log:
Now by default if an user is timed out user or has blocked the POS any other
user can login.
This behavior is reversible using isSameLogin parameter in new
xui.properties.file
Note that this behavior is not specific to POS and could be used by any
applications using XUI
Added:
ofbiz/trunk/framework/guiapp/config/
ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties (with props)
ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties (with props)
ofbiz/trunk/framework/guiapp/config/xui.properties (with props)
Modified:
ofbiz/trunk/framework/guiapp/ofbiz-component.xml
ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java
Added: ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties?rev=604423&view=auto
==============================================================================
--- ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties (added)
+++ ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties Sat Dec 15
04:56:27 2007
@@ -0,0 +1,22 @@
+#####################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# 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
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#####################################################################
+
+UnableToLogIn=Unable to log in; XUI not configured properly
+UserLoginNotValid=UserLogin returned not valid (null)
+UsernameDoesNotMatchLoggedUser=User name does not match already logged in user!
Propchange: ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/framework/guiapp/config/XuiUiLabels.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties?rev=604423&view=auto
==============================================================================
--- ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties (added)
+++ ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties Sat Dec 15
04:56:27 2007
@@ -0,0 +1,22 @@
+#####################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# 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
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#####################################################################
+
+UnableToLogIn=Impossible de continuer : XUI n'est pas configur\u00e9
correctement
+UserLoginNotValid=UserLogin retourn\u00e9 non valide (null)
+UsernameDoesNotMatchLoggedUser=Cet identifiant ne correspond pas \u00e0 celui
en cours !
Propchange: ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/framework/guiapp/config/XuiUiLabels_fr.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ofbiz/trunk/framework/guiapp/config/xui.properties
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/guiapp/config/xui.properties?rev=604423&view=auto
==============================================================================
--- ofbiz/trunk/framework/guiapp/config/xui.properties (added)
+++ ofbiz/trunk/framework/guiapp/config/xui.properties Sat Dec 15 04:56:27 2007
@@ -0,0 +1,21 @@
+#####################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# 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
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#####################################################################
+
+# If isSameLogin equals "true", a logged off user (blocked, time out, ...) can
only log in with the same login/pwd couple. isSameLogin is false by default
(ftrue used for that)
+isSameLogin=ftrue
\ No newline at end of file
Propchange: ofbiz/trunk/framework/guiapp/config/xui.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/framework/guiapp/config/xui.properties
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/framework/guiapp/config/xui.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ofbiz/trunk/framework/guiapp/ofbiz-component.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/guiapp/ofbiz-component.xml?rev=604423&r1=604422&r2=604423&view=diff
==============================================================================
--- ofbiz/trunk/framework/guiapp/ofbiz-component.xml (original)
+++ ofbiz/trunk/framework/guiapp/ofbiz-component.xml Sat Dec 15 04:56:27 2007
@@ -22,6 +22,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
<resource-loader name="main" type="component"/>
+ <classpath type="dir" location="config"/>
<classpath type="jar" location="lib/*"/>
<classpath type="jar" location="build/lib/*"/>
</ofbiz-component>
Modified: ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java?rev=604423&r1=604422&r2=604423&view=diff
==============================================================================
--- ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java
(original)
+++ ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiSession.java Sat
Dec 15 04:56:27 2007
@@ -19,11 +19,13 @@
package org.ofbiz.guiapp.xui;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.webapp.control.LoginWorker;
import org.ofbiz.entity.GenericDelegator;
@@ -43,7 +45,8 @@
protected XuiContainer container = null;
protected Map attributes = new HashMap();
protected String id = null;
-
+ protected final boolean IS_SAME_LOGIN =
UtilProperties.propertyValueEqualsIgnoreCase("xui.properties", "isSameLogin",
"true");
+ private Locale locale = (Locale) Locale.getDefault();
public XuiSession(String id, GenericDelegator delegator, LocalDispatcher
dispatcher, XuiContainer container) {
this.id = id;
@@ -105,10 +108,10 @@
}
public void login(String username, String password) throws
UserLoginFailure {
- // if already logged in; verify for lock
- if (this.userLogin != null) {
- if (!userLogin.getString("userLoginId").equals(username)) {
- throw new UserLoginFailure("Username does not match already
logged in user!");
+ // if already logged in; verify for lock. Depends on SAME_LOGIN, false
by default
+ if (this.userLogin != null) {
+ if (IS_SAME_LOGIN == true &&
!userLogin.getString("userLoginId").equals(username)) {
+ throw new
UserLoginFailure(UtilProperties.getMessage("XuiUiLabels",
"UsernameDoesNotMatchLoggedUser", locale));
}
}
this.userLogin = this.checkLogin(username, password);
@@ -117,13 +120,13 @@
public GenericValue checkLogin(String username, String password) throws
UserLoginFailure {
// check the required parameters and objects
if (dispatcher == null) {
- throw new UserLoginFailure("Unable to log in; XUI not configured
propertly");
+ throw new
UserLoginFailure(UtilProperties.getMessage("XuiUiLabels", "UnableToLogIn",
locale));
}
if (UtilValidate.isEmpty(username)) {
- throw new UserLoginFailure("Username is missing");
+ throw new
UserLoginFailure(UtilProperties.getMessage("PartyUiLabels",
"PartyUserNameMissing", locale));
}
if (UtilValidate.isEmpty(password)) {
- throw new UserLoginFailure("Password is missing");
+ throw new
UserLoginFailure(UtilProperties.getMessage("PartyUiLabels",
"PartyPasswordMissing", locale));
}
// call the login service
@@ -134,7 +137,7 @@
Debug.logError(e, module);
throw new UserLoginFailure(e);
} catch (Throwable t) {
- Debug.logError(t, "Thowable caught!", module);
+ Debug.logError(t, "Throwable caught!", module);
}
// check for errors
@@ -143,7 +146,7 @@
} else {
GenericValue ul = (GenericValue) result.get("userLogin");
if (ul == null) {
- throw new UserLoginFailure("UserLogin return was not valid
(null)");
+ throw new
UserLoginFailure(UtilProperties.getMessage("XuiUiLabels", "UserLoginNotValid",
locale));
}
return ul;
}