Skip to content

Commit

Permalink
addons
Browse files Browse the repository at this point in the history
  • Loading branch information
caroalvarezsilva committed Oct 20, 2018
1 parent a64deef commit 5b17798
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 22 deletions.
Binary file modified bin/com/openxava/naviox/Modules$ModuleComparator.class
Binary file not shown.
Binary file modified bin/com/openxava/naviox/Modules.class
Binary file not shown.
Binary file modified bin/com/openxava/naviox/impl/SignInHelper.class
Binary file not shown.
Binary file modified bin/com/openxava/naviox/util/NaviOXPreferences.class
Binary file not shown.
Binary file modified bin/com/openxava/naviox/web/NaviOXFilter.class
Binary file not shown.
Binary file modified bin/com/openxava/naviox/web/NaviOXServlet.class
Binary file not shown.
Binary file modified bin/com/openxava/naviox/web/SecureRequest.class
Binary file not shown.
2 changes: 1 addition & 1 deletion properties-templates/naviox.properties
Expand Up @@ -7,7 +7,7 @@ initialPasswordForAdmin=admin
# There are many more password options in Configuration module of XavaPro (http://www.openxava.org/xavapro)

# Navigation options
startInLastVisitedModule=true
startInLastVisitedModule=false
rememberVisitedModules=false
showModulesMenuWhenNotLogged=true

Expand Down
38 changes: 38 additions & 0 deletions src/com/openxava/naviox/LDAPAuthenticator.java
@@ -0,0 +1,38 @@
package com.openxava.naviox;

import java.util.*;

import javax.naming.*;
import javax.naming.directory.*;

import com.openxava.naviox.util.*;

public class LDAPAuthenticator {

public boolean authenticateUser(String username, String password, String userType) {

String ldapURL = (String)NaviOXPreferences.getInstance().getLDAPConfiguration(userType).get("ldapURL");
String ldapBase = (String)NaviOXPreferences.getInstance().getLDAPConfiguration(userType).get("ldapBase");
String dn = "uid=" + username + "," + ldapBase;
Hashtable<String, String> environment = new Hashtable<String, String>();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.PROVIDER_URL, ldapURL);
environment.put(Context.SECURITY_AUTHENTICATION, "simple");
environment.put(Context.SECURITY_PRINCIPAL, dn);
environment.put(Context.SECURITY_CREDENTIALS, password);

try {
DirContext authContext = new InitialDirContext(environment);
return true;

} catch (AuthenticationException ex) {
ex.printStackTrace();
return false;
}

catch (NamingException ex) {
ex.printStackTrace();
return false;
}
}
}
5 changes: 4 additions & 1 deletion src/com/openxava/naviox/Modules.java
Expand Up @@ -63,6 +63,9 @@ public void reset() {
if (!NaviOXPreferences.getInstance().isStartInLastVisitedModule()) {
try {
getPreferences().remove("current");
// Preferences preferences = getPreferences();
// preferences.remove("current");
// preferences.flush();
} catch (BackingStoreException ex) {
log.warn(XavaResources.getString("current_module_problem"), ex);
}
Expand Down Expand Up @@ -313,7 +316,7 @@ private void storeModulesInPreferences(Collection<MetaModule> modules, String pr
preferences.remove(prefix + "module." + i);
}
if (storeCurrent && !"SignIn".equals(current.getName())) {
preferences.put("current", current.getName());
// Consultorio Juridico preferences.put("current", current.getName());
}

preferences.flush();
Expand Down
6 changes: 6 additions & 0 deletions src/com/openxava/naviox/impl/SignInHelper.java
Expand Up @@ -33,6 +33,12 @@ public static void signIn(HttpSession session, String userName, String userType)
session.setAttribute("naviox.user", userName);
session.setAttribute("naviox.userType", userType);
Modules modules = (Modules) session.getAttribute("modules");
modules.reset();
}

public static void signIn(HttpSession session, String userName) {
session.setAttribute("naviox.user", userName);
Modules modules = (Modules) session.getAttribute("modules");
modules.reset();
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/openxava/naviox/util/NaviOXPreferences.java
Expand Up @@ -123,7 +123,7 @@ public boolean isShowOrganizationOnSignIn() {
* @since 5.3
*/
public boolean isStartInLastVisitedModule() {
return "true".equalsIgnoreCase(getProperties().getProperty("startInLastVisitedModule", "true").trim());
return "true".equalsIgnoreCase(getProperties().getProperty("startInLastVisitedModule", "false").trim());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/com/openxava/naviox/web/NaviOXFilter.java
Expand Up @@ -38,7 +38,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
String autologinUser = NaviOXPreferences.getInstance().getAutologinUser();
if (!Is.emptyString(autologinUser)) {
if (SignInHelper.isAuthorized(autologinUser, NaviOXPreferences.getInstance().getAutologinPassword())) {
SignInHelper.signIn(session, autologinUser, null);
SignInHelper.signIn(session, autologinUser);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/openxava/naviox/web/NaviOXServlet.java
Expand Up @@ -25,7 +25,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
}
String url = Browsers.isMobile(request)?"/p/" + uri[3]:"/naviox/index.jsp?application=" + uri[1] + "&module=" + uri[3];
RequestDispatcher dispatcher = request.getRequestDispatcher(url);

response.setBufferSize(8192 * 16);
Style.setPotalInstance(NaviOXStyle.getInstance()); // We manage style in NaviOX as in the portal case, to override the style defined in xava.properties and by device
dispatcher.forward(request, response);
}
Expand Down
1 change: 1 addition & 0 deletions src/com/openxava/naviox/web/SecureRequest.java
Expand Up @@ -12,6 +12,7 @@ public SecureRequest(ServletRequest request) {
super( (HttpServletRequest) request);
}


public String getRemoteUser() {
return (String) ((HttpServletRequest) getRequest()).getSession().getAttribute("naviox.user");
}
Expand Down
31 changes: 29 additions & 2 deletions web/index.jsp
@@ -1,14 +1,41 @@
<%-- <%@page import="com.openxava.phone.web.Browsers"%> --%>
<%-- <%@page import="org.openxava.util.Users"%> --%>

<%-- <jsp:useBean id="modules" class="com.openxava.naviox.Modules" scope="session"/> --%>

<%--
Users.setCurrent(request);
// String module = Users.getCurrent() == null?"SignIn":modules.getCurrent(request);
// String url = Browsers.isMobile(request)?"phone":"m/" + module;
--%>

<!-- <script type="text/javascript"> -->
<%-- window.location="<%=url%>"; --%>
<!-- </script> -->

<%@page import="com.openxava.naviox.util.Organizations"%>
<%@page import="com.openxava.phone.web.Browsers"%>
<%@page import="org.openxava.util.Users"%>

<jsp:useBean id="modules" class="com.openxava.naviox.Modules" scope="session"/>

<%
Users.setCurrent(request);
String module = Users.getCurrent() == null?"SignIn":modules.getCurrent(request);
String url = Browsers.isMobile(request)?"phone":"m/" + module;
if (Users.getCurrent() != null || Organizations.getCurrent(request) != null) {
String module = Users.getCurrent() == null?"SignIn":modules.getCurrent(request);
String url = Browsers.isMobile(request) && !"Index".equals(modules.getCurrent(request))?"phone":"m/" + module;
%>

<script type="text/javascript">
window.location="<%=url%>";
</script>

<%
}
else {
%>
<jsp:include page="naviox/welcome.jsp"/>
<%
}
%>

16 changes: 1 addition & 15 deletions web/naviox/firstSteps.jsp
@@ -1,15 +1 @@
<%@include file="../xava/imports.jsp"%>

<%-- To put your own text add entries in the i18n messages files of your project --%>

<%
String language = "es".equals(request.getLocale().getLanguage()) || "ca".equals(request.getLocale().getLanguage())?"es":"en";
%>

<div id="first_steps">
<p><xava:message key="first_steps_p1"/></p>
<p class="screenshot"><img src="../naviox/images/modules-screenshot_<%=language%>.png"/></p>
<p><xava:message key="first_steps_p2"/></p>
<p class="screenshot"><img src="../naviox/images/list-mode-screenshot_<%=language%>.png"/></p>
<p><xava:message key="first_steps_p3"/></p>
</div>
<jsp:forward page="/m/TodayAgendaRequest"></jsp:forward>

0 comments on commit 5b17798

Please sign in to comment.