Index: lams_admin/build.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/build.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/build.properties 10 Feb 2005 03:53:54 -0000 1.1
@@ -0,0 +1,59 @@
+# Ant properties for building the lams survey tool
+
+#name of this project
+name=lams_admin
+
+# Library directory within project. Where third party jars reside.
+lams_commondir=../lams_common
+lib.dir=${basedir}/lib
+common.lib.dir=${lams_commondir}/lib
+common.build.dir=${lams_commondir}/build/classes
+
+# Source directory under the current root
+src.dir=${basedir}/src
+src.dir.java=${src.dir}/java
+test.dir=${basedir}/test
+test.dir.java=${test.dir}/java
+
+# Build directory
+build=${basedir}/build
+build.classes.java=${build}/classes/java
+build.classes.test=${build}/classes/test
+build.lib=${build}/lib
+build.report=${build}/report
+
+
+jboss.home.windows.dir=C:/jboss-3.2.6
+jboss.deploy.windows.dir=${jboss.home.windows.dir}/server/default/deploy
+jboss.home.unix.dir=/usr/local/jboss-3.2.6
+jboss.deploy.unix.dir=${jboss.home.unix.dir}/server/default/deploy
+
+
+#configuration files
+conf.dir=${basedir}/conf
+conf.web.dir=${basedir}/web
+conf.webinf.dir=${conf.web.dir}/WEB-INF
+conf.struts.dir=${conf.web.dir}/WEB-INF/struts
+conf.xdoclet.dir=${conf.dir}/xdoclet
+
+lamsconf.windows.dir=C:/lamsconf
+lamsconf.unix.dir=/usr/local/lamsconf
+
+conf.windows.dir=${conf.dir}/windows
+conf.jboss.windows.dir=${conf.windows.dir}/jboss
+conf.auth.windows.dir=${conf.windows.dir}/authentication
+conf.lams.windows.dir=${conf.windows.dir}/lams
+conf.unix.dir=${conf.dir}/unix
+conf.jboss.unix.dir=${conf.unix.dir}/jboss
+conf.auth.unix.dir=${conf.unix.dir}/authentication
+conf.lams.unix.dir=${conf.unix.dir}/lams
+
+#xdoclet version number
+xdoclet.version=1.2.2
+
+#web application properties
+sessiontimeout=120
+
+#Gui or not?
+gui=true
+
Index: lams_admin/build.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/build.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/build.xml 10 Feb 2005 03:53:54 -0000 1.1
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You must download several jar files before you can build
+ Middlegen. Execute the "download-deps" target. Then try to
+ build again.
+
+ If you are behind a proxy, you should define the properties
+ http.proxyHost and http.proxyPort. Example:
+
+ ant -Dhttp.proxyHost=foo.com -Dhttp.proxyPort=8080
+
+ It's also possible to download the jars manually.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_admin/conf/unix/authentication/authentication.dtd
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/unix/authentication/Attic/authentication.dtd,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/unix/authentication/authentication.dtd 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
Index: lams_admin/conf/unix/authentication/authentication.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/unix/authentication/Attic/authentication.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/unix/authentication/authentication.xml 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ com.sun.jndi.ldap.LdapCtxFactory
+ ldap://mams.melcoe.mq.edu.au:636
+ simple
+ ssl
+ uid=
+ ,ou=mams,dc=melcoe,dc=mq,dc=edu,dc=au
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+ D:/MQLdapTrustStore
+ webauth
+
+
+
+
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
+ WEBAUTH_USER
+ https://array00.melcoe.mq.edu.au/webauth.html
+ dummy
+ java:/MySqlDS
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
+
+ ldap://mams.melcoe.mq.edu.au:636
+ ssl
+
+ MQLdapTrustStore
+ simple
+ cn=admin,dc=melcoe,dc=mq,dc=edu,dc=au
+ KingKong
+ ou=mams,dc=melcoe,dc=mq,dc=edu,dc=au
+
+ login=uid,firstName=givenName,lastName=sn,email=mail
+ com.sun.jndi.ldap.LdapCtxFactory
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
Index: lams_admin/conf/unix/jboss/login-config.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/unix/jboss/Attic/login-config.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/unix/jboss/login-config.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ guest
+ java:/DefaultDS
+ SELECT PASSWD FROM JMS_USERS WHERE USERID=?
+ SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?
+
+
+
+
+
+
+
+
+ sa
+ sa
+
+ jboss.jca:service=LocalTxCM,name=DefaultDS
+
+
+
+
+
+
+
+ sysdba
+ sysdba
+ masterkey
+ jboss.jca:service=XaTxCM,name=FirebirdDS
+
+
+
+
+
+
+
+ guest
+ guest
+ guest
+ jboss.jca:service=TxCM,name=JmsXA
+
+
+
+
+
+
+
+
+ jmx-console-users.properties
+ jmx-console-roles.properties
+
+
+
+
+
+
+
+
+ web-console-users.properties
+ web-console-roles.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
+
+
+
+
+ /usr/local/lamsconf/authentication.xml
+
+
+
+
+
+
+
Index: lams_admin/conf/unix/jboss/service/mysql-ds.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/unix/jboss/service/Attic/mysql-ds.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/unix/jboss/service/mysql-ds.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+ MySqlDS
+ jdbc:mysql://localhost:3306/lams
+ com.mysql.jdbc.Driver
+ lams
+ lamsdemo
+
+
\ No newline at end of file
Index: lams_admin/conf/unix/lams/lams.dtd
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/unix/lams/Attic/lams.dtd,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/unix/lams/lams.dtd 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_admin/conf/unix/lams/lams.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/unix/lams/Attic/lams.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/unix/lams/lams.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+ /var/opt/lams
+ /var/opt/lams/temp
+ mail.lib.mq.edu.au
+ lams_support@melcoe.mq.edu.au
+ 1048576
+ 10485760
+ 4096
+
+ 9800
+ /usr/local/jboss-3.2.6/server/default/deploy/upload.war
+ .bat,.bin,.com,.cmd,.exe,.msi,.msp,.ocx,.pif,.scr,.sct,.sh,.shs,.vbs
+ /usr/local/jboss-3.2.6/server/default/conf/lams.tck
+
+ 86400
+
+
+ false
+
Index: lams_admin/conf/windows/authentication/authentication.dtd
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/windows/authentication/Attic/authentication.dtd,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/windows/authentication/authentication.dtd 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
Index: lams_admin/conf/windows/authentication/authentication.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/windows/authentication/Attic/authentication.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/windows/authentication/authentication.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ com.sun.jndi.ldap.LdapCtxFactory
+ ldap://mams.melcoe.mq.edu.au:636
+ simple
+ ssl
+ uid=
+ ,ou=mams,dc=melcoe,dc=mq,dc=edu,dc=au
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+ D:/MQLdapTrustStore
+ webauth
+
+
+
+
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
+ WEBAUTH_USER
+ https://array00.melcoe.mq.edu.au/webauth.html
+ dummy
+ java:/MySqlDS
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
+
+ ldap://mams.melcoe.mq.edu.au:636
+ ssl
+
+ MQLdapTrustStore
+ simple
+ cn=admin,dc=melcoe,dc=mq,dc=edu,dc=au
+ KingKong
+ ou=mams,dc=melcoe,dc=mq,dc=edu,dc=au
+
+ login=uid,firstName=givenName,lastName=sn,email=mail
+ com.sun.jndi.ldap.LdapCtxFactory
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
Index: lams_admin/conf/windows/jboss/login-config.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/windows/jboss/Attic/login-config.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/windows/jboss/login-config.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ guest
+ java:/DefaultDS
+ SELECT PASSWD FROM JMS_USERS WHERE USERID=?
+ SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?
+
+
+
+
+
+
+
+
+ sa
+ sa
+
+ jboss.jca:service=LocalTxCM,name=DefaultDS
+
+
+
+
+
+
+
+ sysdba
+ sysdba
+ masterkey
+ jboss.jca:service=XaTxCM,name=FirebirdDS
+
+
+
+
+
+
+
+ guest
+ guest
+ guest
+ jboss.jca:service=TxCM,name=JmsXA
+
+
+
+
+
+
+
+
+ jmx-console-users.properties
+ jmx-console-roles.properties
+
+
+
+
+
+
+
+
+ web-console-users.properties
+ web-console-roles.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java:/MySqlDS
+ select password from lams_user where login=?
+ select name,'Roles' from lams_role, lams_user where login=?
+
+
+
+
+
+
+
+ c:/lamsconf/authentication.xml
+
+
+
+
+
+
+
Index: lams_admin/conf/windows/jboss/service/mysql-ds.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/windows/jboss/service/Attic/mysql-ds.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/windows/jboss/service/mysql-ds.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+ MySqlDS
+ jdbc:mysql://localhost:3306/lams11
+ com.mysql.jdbc.Driver
+ lams
+ lamsdemo
+
+
\ No newline at end of file
Index: lams_admin/conf/windows/lams/lams.dtd
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/windows/lams/Attic/lams.dtd,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/windows/lams/lams.dtd 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_admin/conf/windows/lams/lams.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/windows/lams/Attic/lams.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/windows/lams/lams.xml 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+ C:/lams
+ C:/lams/temp
+ mail.lib.mq.edu.au
+ lams_support@melcoe.mq.edu.au
+ 1048576
+ 10485760
+ 4096
+
+ 9800
+ c:/jboss-3.2.6/server/default/deploy/upload.war
+ .bat,.bin,.com,.cmd,.exe,.msi,.msp,.ocx,.pif,.scr,.sct,.sh,.shs,.vbs
+ c:/jboss-3.2.6/server/default/conf/lams.tck
+
+ 86400
+
+
+ false
+
Index: lams_admin/conf/xdoclet/global-forwards.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/xdoclet/global-forwards.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/xdoclet/global-forwards.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,3 @@
+
+
+
Index: lams_admin/conf/xdoclet/struts-message-resources.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/xdoclet/struts-message-resources.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/xdoclet/struts-message-resources.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,2 @@
+
+
Index: lams_admin/conf/xdoclet/struts-plugins.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/conf/xdoclet/struts-plugins.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/conf/xdoclet/struts-plugins.xml 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/Attic/applicationResources.properties,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/applicationResources.properties 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,8 @@
+# Resources for parameter 'com.lamsinternational.lams.applicationResources'
+
+#=========================labels===========================#
+
+#=========================Error Messages===========================#
+error.authorisation=You are not authorised to do this.
+error.newpassword.mismatch=Your new passwords don't match each other.
+error.oldpassword.mismatch=Your old password is not correct.
\ No newline at end of file
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/HomeAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/Attic/HomeAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/HomeAction.java 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,223 @@
+package org.lamsfoundation.lams.admin.login.web;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.actions.DispatchAction;
+
+import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.context.WebApplicationContext;
+
+import org.lamsfoundation.lams.admin.login.web.PasswordChangeActionForm;
+import org.lamsfoundation.lams.admin.util.AdminPreparer;
+import org.lamsfoundation.lams.web.HttpSessionManager;
+import org.lamsfoundation.lams.usermanagement.Role;
+import org.lamsfoundation.lams.usermanagement.Organisation;
+import org.lamsfoundation.lams.usermanagement.service.UserManagementService;
+
+import org.lamsfoundation.lams.util.Configuration;
+import org.lamsfoundation.lams.util.ConfigurationKeys;
+
+
+/**
+ * this is an action where all lams client environments launch.
+ * initial configuration of the individual environment setting is done here.
+ *
+ * @struts:action path="/home"
+ * validate="false"
+ * parameter="method"
+ * @struts:action-forward name="admin" path=".admin"
+ * @struts:action-forward name="learner" path="/learner.jsp"
+ * @struts:action-forward name="author" path="/author.jsp"
+ * @struts:action-forward name="staff" path="/staff.jsp"
+ * @struts:action-forward name="error" path=".error"
+ * @struts:action-forward name="passwordChange" path=".passwordChange"
+ *
+ */
+public class HomeAction extends DispatchAction {
+
+ private static Logger log = Logger.getLogger(HomeAction.class);
+ private static WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(HttpSessionManager.getInstance().getServletContext());
+ private static UserManagementService service = (UserManagementService) ctx.getBean("userManagementServiceTarget");
+
+
+ private boolean isUserInRole(String login,int orgId, String roleName)
+ {
+ if (service.getUserOrganisationRole(login, new Integer(orgId),roleName)==null)
+ return false;
+ return true;
+ }
+
+ /**
+ * request for sysadmin environment
+ */
+ public ActionForward admin(ActionMapping mapping, ActionForm form,
+ HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException {
+
+ try {
+ log.debug("request admin");
+
+ String login = req.getRemoteUser();
+
+ int orgId = new Integer(req.getParameter("orgId")).intValue();
+
+ if ( isUserInRole(login,orgId,Role.ADMIN))
+ {
+ log.debug("user is admin");
+ Organisation org = service.getOrganisationById(new Integer(orgId));
+ AdminPreparer.prepare(org,req,service);
+ return mapping.findForward("admin");
+ }
+ else
+ {
+ log.error("User "+login+" tried to get admin screen but isn't admin in organisation: "+orgId);
+ return mapping.findForward("error");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return mapping.findForward("error");
+ }
+ }
+
+ /**
+ * request for learner environment
+ */
+ public ActionForward learner(ActionMapping mapping, ActionForm form,
+ HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException {
+
+ try {
+ log.debug("request learner");
+
+ String login = req.getRemoteUser();
+
+ int orgId = new Integer(req.getParameter("orgId")).intValue();
+
+ if ( isUserInRole(login,orgId,Role.LEARNER) )
+ {
+ log.debug("user is learner");
+
+ String serverUrl = Configuration.get(ConfigurationKeys.SERVER_URL);
+
+ req.setAttribute("serverUrl", serverUrl);
+ return mapping.findForward("learner");
+ }
+ else
+ {
+ log.error("User "+login+" tried to get learner screen but isn't learner in organisation: "+orgId);
+ return mapping.findForward("error");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return mapping.findForward("error");
+ }
+ }
+
+
+ /**
+ * request for author environment
+ */
+ public ActionForward author(ActionMapping mapping, ActionForm form,
+ HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException {
+
+ try {
+ log.debug("request author");
+
+ String login = req.getRemoteUser();
+
+ int orgId = new Integer(req.getParameter("orgId")).intValue();
+
+ if ( isUserInRole(login,orgId,Role.AUTHOR) )
+ {
+ log.debug("user is author");
+
+ String serverUrl = Configuration.get(ConfigurationKeys.SERVER_URL);
+
+ req.setAttribute("serverUrl", serverUrl);
+ return mapping.findForward("author");
+ }
+ else
+ {
+ log.error("User "+login+" tried to get author screen but isn't author in organisation: "+orgId);
+ return mapping.findForward("error");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return mapping.findForward("error");
+ }
+ }
+
+
+ /**
+ * request for staff environment
+ */
+ public ActionForward staff(ActionMapping mapping, ActionForm form,
+ HttpServletRequest req, HttpServletResponse res)
+ throws IOException, ServletException {
+
+ try {
+ log.debug("request staff");
+
+ String login = req.getRemoteUser();
+
+ int orgId = new Integer(req.getParameter("orgId")).intValue();
+
+ if (isUserInRole(login, orgId, Role.STAFF)) {
+ log.debug("user is staff");
+
+ String serverUrl = Configuration
+ .get(ConfigurationKeys.SERVER_URL);
+
+ req.setAttribute("serverUrl", serverUrl);
+ return mapping.findForward("staff");
+ } else {
+ log
+ .error("User "
+ + login
+ + " tried to get staff screen but isn't staff in organisation: "
+ + orgId);
+ return mapping.findForward("error");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return mapping.findForward("error");
+ }
+ }
+
+ /**
+ * Loads up the user password change form
+ * @return screen reference name - "passwordChange"
+ */
+ public ActionForward passwordChange(
+ ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException, ServletException {
+
+ String login = request.getRemoteUser();
+
+ PasswordChangeActionForm newForm = new PasswordChangeActionForm();
+ newForm.setLogin(login);
+
+ request.getSession(true).setAttribute(
+ PasswordChangeActionForm.formName,
+ newForm);
+
+ return mapping.findForward("passwordChange");
+ }
+
+}
\ No newline at end of file
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/PasswordChangeAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/Attic/PasswordChangeAction.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/PasswordChangeAction.java 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,112 @@
+package org.lamsfoundation.lams.admin.login.web;
+
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.lamsfoundation.lams.usermanagement.service.UserManagementService;
+
+import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.context.WebApplicationContext;
+
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.Action;
+
+/**
+ * @author Fei Yang
+ *
+ * @struts:action path="/passwordChanged"
+ * name="PasswordChangeActionForm"
+ * input=".passwordChange"
+ * validate="true"
+ *
+ * @struts:action-forward name="okay" path=".passwordChangeOk"
+ * @struts:action-forward name="cancelled" path="/index.jsp"
+ */
+public class PasswordChangeAction extends Action {
+
+ private static Logger log = Logger.getLogger(PasswordChangeAction.class);
+
+ /**
+ * @param mapping The ActionMapping used to select this instance
+ * @param actionForm The optional ActionForm bean for this request (if any)
+ * @param request The HTTP request we are processing
+ * @param response The HTTP response we are creating
+ *
+ */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception
+ {
+ // -- isCancelled?
+ if (isCancelled(request)) {
+ request.getSession().removeAttribute(PasswordChangeActionForm.formName);
+ return mapping.findForward("cancelled");
+ }
+
+
+ ActionErrors errors = new ActionErrors();
+
+ PasswordChangeActionForm passwordChangeForm = (PasswordChangeActionForm) form;
+
+ if (errors.isEmpty())
+ {
+ try {
+
+ String loggedInUser = request.getRemoteUser();
+ String login = passwordChangeForm.getLogin();
+ String oldPassword = passwordChangeForm.getOldPassword();
+ String password = passwordChangeForm.getPassword();
+
+ if ( loggedInUser == null || ! loggedInUser.equals(login) )
+ {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.authorisation"));
+ }
+ else
+ {
+
+ WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession(true).getServletContext());
+ UserManagementService service = (UserManagementService)ctx.getBean("userManagementServiceTarget");
+ if(!service.getUserByLogin(login).getPassword().equals(oldPassword))
+ {
+ errors.add("oldPassword", new ActionMessage("error.oldpassword.mismatch"));
+ }
+ else
+ {
+ service.updatePassword(login, password );
+ }
+ }
+
+ } catch (Exception e) {
+ log.error("Exception occured ",e);
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(e.getMessage()));
+ }
+
+ } // end if no errors
+
+ // -- Report any errors
+ if (!errors.isEmpty()) {
+ addErrors(request, errors);
+ if (mapping.getInput()!=null)
+ {
+ passwordChangeForm.reset(mapping,request);
+ return (new ActionForward(mapping.getInput()));
+ }
+ // If no input page, use error forwarding
+ return (mapping.findForward("error"));
+ }
+ return mapping.findForward("okay");
+
+ }
+}
+
+
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/PasswordChangeActionForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/Attic/PasswordChangeActionForm.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/login/web/PasswordChangeActionForm.java 10 Feb 2005 03:52:32 -0000 1.1
@@ -0,0 +1,145 @@
+package org.lamsfoundation.lams.admin.login.web;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionErrors;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * @author fmalikoff
+ * @Modified by Fei Yang
+ *
+ * @struts:form name="PasswordChangeActionForm"
+ * include-pk="true"
+ * include-all="true"
+ */
+public class PasswordChangeActionForm extends ActionForm {
+
+ public static final String formName = "PasswordChangeActionForm"; // must match name in @struts:action section above
+
+ private static Logger log = Logger.getLogger(PasswordChangeActionForm.class);
+
+ private String oldPassword;
+
+ private String password;
+
+ private String passwordConfirm;
+
+ private String login;
+
+ public PasswordChangeActionForm() {
+ }
+
+ /**
+ * Returns the login.
+ * @return String
+ */
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * Returns the password.
+ * @return String
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Returns the passwordConfirm.
+ * @return String
+ */
+ public String getPasswordConfirm() {
+ return passwordConfirm;
+ }
+
+ /**
+ * Sets the login.
+ * @param login The login to set
+ */
+ public void setLogin(String login) {
+ this.login = StringUtils.trimToEmpty(login);
+ }
+
+ /**
+ * Sets the password.
+ * @param password The password to set
+ */
+ public void setPassword(String password) {
+ this.password = StringUtils.trimToEmpty(password);
+ }
+
+ /**
+ * Sets the passwordConfirm.
+ * @param passwordConfirm The passwordConfirm to set
+ */
+ public void setPasswordConfirm(String passwordConfirm) {
+ this.passwordConfirm = StringUtils.trimToEmpty(passwordConfirm);
+ }
+
+ /**
+ * @return Returns the oldPassword.
+ */
+ public String getOldPassword() {
+ return oldPassword;
+ }
+
+ /**
+ * @param oldPassword The oldPassword to set.
+ */
+ public void setOldPassword(String oldPassword) {
+ this.oldPassword = StringUtils.trimToEmpty(oldPassword);
+ }
+
+ /**
+ * Reset all properties to their default values.
+ *
+ * @param mapping The mapping used to select this instance
+ * @param request The servlet request we are processing
+ */
+ public void reset(ActionMapping mapping, HttpServletRequest request) {
+ setOldPassword(null);
+ setPassword(null);
+ setPasswordConfirm(null);
+ }
+
+ /**
+ * Validate the properties that have been set from this HTTP request,
+ * and return an ActionErrors object that encapsulates any
+ * validation errors that have been found. If no errors are found, return
+ * null or an ActionErrors object with no
+ * recorded error messages.
+ *
+ * @param mapping The mapping used to select this instance
+ * @param request The servlet request we are processing
+ */
+ public ActionErrors validate(ActionMapping mapping,
+ HttpServletRequest request) {
+ ActionErrors errors = super.validate(mapping, request);
+
+ if (errors == null)
+ errors = new ActionErrors();
+
+ if (getPassword() == null || getPassword().length() == 0
+ || !getPassword().equals(getPasswordConfirm())) {
+ errors.add("password", new ActionMessage("error.newpassword.mismatch"));
+ }
+
+ if (errors.isEmpty())
+ return null;
+ else {
+ // don't want to pass back what they had as the password
+ setOldPassword(null);
+ setPassword(null);
+ setPasswordConfirm(null);
+ return errors;
+ }
+
+ }
+
+}
\ No newline at end of file
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/security/AbstractServerLoginModule.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/security/Attic/AbstractServerLoginModule.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/security/AbstractServerLoginModule.java 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,284 @@
+package org.lamsfoundation.lams.admin.security;
+
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.lang.reflect.Constructor;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+import org.apache.log4j.Logger;
+
+public class AbstractServerLoginModule implements LoginModule
+{
+ protected Subject subject;
+ protected CallbackHandler callbackHandler;
+ protected Map sharedState;
+ protected Map options;
+ protected Logger log = Logger.getLogger(AbstractServerLoginModule.class);
+ /** Flag indicating if the shared credential should be used */
+ protected boolean useFirstPass;
+ /** Flag indicating if the login phase succeeded. Subclasses that override
+ the login method must set this to true on successful completion of login
+ */
+ protected boolean loginOk;
+ /** An optional custom Principal class implementation */
+ protected String principalClassName;
+ /** the principal to use when a null username and password are seen */
+ protected Principal unauthenticatedIdentity;
+
+ /** Initialize the login module. This stores the subject, callbackHandler
+ * and sharedState and options for the login session. Subclasses should override
+ * if they need to process their own options. A call to super.initialize(...)
+ * must be made in the case of an override.
+ *
+ * @option password-stacking: If this is set to "useFirstPass", the login
+ * identity will be taken from the javax.security.auth.login.name
+ * value of the sharedState map, and the proof of identity from the
+ * javax.security.auth.login.password value of the sharedState
+ * map.
+ * @option principalClass: A Principal implementation that support a ctor
+ * taking a String argument for the princpal name.
+ * @option unauthenticatedIdentity: the name of the principal to asssign
+ * and authenticate when a null username and password are seen.
+ *
+ * @param subject the Subject to update after a successful login.
+ * @param callbackHandler the CallbackHandler that will be used to obtain the
+ * the user identity and credentials.
+ * @param sharedState a Map shared between all configured login module instances
+ * @param options the parameters passed to the login module.
+ */
+ public void initialize(Subject subject, CallbackHandler callbackHandler,
+ Map sharedState, Map options)
+ {
+ this.subject = subject;
+ this.callbackHandler = callbackHandler;
+ this.sharedState = sharedState;
+ this.options = options;
+ log = Logger.getLogger(getClass());
+ log.info("initialize");
+ /* Check for password sharing options. Any non-null value for
+ password_stacking sets useFirstPass as this module has no way to
+ validate any shared password.
+ */
+ String passwordStacking = (String) options.get("password-stacking");
+ if( passwordStacking != null && passwordStacking.equalsIgnoreCase("useFirstPass") )
+ useFirstPass = true;
+
+ // Check for a custom Principal implementation
+ principalClassName = (String) options.get("principalClass");
+
+ // Check for unauthenticatedIdentity option.
+ String name = (String) options.get("unauthenticatedIdentity");
+ if( name != null )
+ {
+ try
+ {
+ unauthenticatedIdentity = createIdentity(name);
+ log.info("Saw unauthenticatedIdentity="+name);
+ }
+ catch(Exception e)
+ {
+ log.warn("Failed to create custom unauthenticatedIdentity", e);
+ }
+ }
+ }
+
+ /** Looks for javax.security.auth.login.name and javax.security.auth.login.password
+ values in the sharedState map if the useFirstPass option was true and returns
+ true if they exist. If they do not or are null this method returns false.
+
+ Note that subclasses that override the login method must set the loginOk
+ ivar to true if the login succeeds in order for the commit phase to
+ populate the Subject. This implementation sets loginOk to true if the
+ login() method returns true, otherwise, it sets loginOk to false.
+ */
+ public boolean login() throws LoginException
+ {
+ log.info("login");
+ loginOk = false;
+ // If useFirstPass is true, look for the shared password
+ if( useFirstPass == true )
+ {
+ try
+ {
+ Object identity = sharedState.get("javax.security.auth.login.name");
+ Object credential = sharedState.get("javax.security.auth.login.password");
+ if( identity != null && credential != null )
+ {
+ loginOk = true;
+ return true;
+ }
+ // Else, fall through and perform the login
+ }
+ catch(Exception e)
+ { // Dump the exception and continue
+ log.error("login failed", e);
+ }
+ }
+ return false;
+ }
+
+ /** Method to commit the authentication process (phase 2). If the login
+ method completed successfully as indicated by loginOk == true, this
+ method adds the getIdentity() value to the subject getPrincipals() Set.
+ It also adds the members of each Group returned by getRoleSets()
+ to the subject getPrincipals() Set.
+
+ @see javax.security.auth.Subject;
+ @see java.security.acl.Group;
+ @return true always.
+ */
+ public boolean commit() throws LoginException
+ {
+ log.info("commit, loginOk="+loginOk);
+ if( loginOk == false )
+ return false;
+
+ Set principals = subject.getPrincipals();
+ Principal identity = getIdentity();
+ principals.add(identity);
+ Group[] roleSets = getRoleSets();
+ for(int g = 0; g < roleSets.length; g ++)
+ {
+ Group group = roleSets[g];
+ String name = group.getName();
+ Group subjectGroup = createGroup(name, principals);
+ if( subjectGroup instanceof NestableGroup )
+ {
+ /* A NestableGroup only allows Groups to be added to it so we
+ need to add a SimpleGroup to subjectRoles to contain the roles
+ */
+ SimpleGroup tmp = new SimpleGroup("Roles");
+ subjectGroup.addMember(tmp);
+ subjectGroup = tmp;
+ }
+ // Copy the group members to the Subject group
+ Enumeration members = group.members();
+ while( members.hasMoreElements() )
+ {
+ Principal role = (Principal) members.nextElement();
+ subjectGroup.addMember(role);
+ }
+ }
+ return true;
+ }
+
+ /** Method to abort the authentication process (phase 2).
+ @return true alaways
+ */
+ public boolean abort() throws LoginException
+ {
+ log.info("abort");
+ return true;
+ }
+
+ /** Remove the user identity and roles added to the Subject during commit.
+ @return true always.
+ */
+ public boolean logout() throws LoginException
+ {
+ log.info("logout");
+ // Remove the user identity
+ Principal identity = getIdentity();
+ Set principals = subject.getPrincipals();
+ principals.remove(identity);
+ // Remove any added Groups...
+ return true;
+ }
+ //--- End LoginModule interface methods
+
+ // --- Protected methods
+
+ /** Overriden by subclasses to return the Principal that corresponds to
+ the user primary identity.
+ */
+ protected Principal getIdentity()
+ {
+ return null;
+ }
+ /** Overriden by subclasses to return the Groups that correspond to the
+ to the role sets assigned to the user. Subclasses should create at
+ least a Group named "Roles" that contains the roles assigned to the user.
+ A second common group is "CallerPrincipal" that provides the application
+ identity of the user rather than the security domain identity.
+ @return Group[] containing the sets of roles
+ */
+ protected Group[] getRoleSets() throws LoginException
+ {
+ return null;
+ }
+
+ protected boolean getUseFirstPass()
+ {
+ return useFirstPass;
+ }
+ protected Principal getUnauthenticatedIdentity()
+ {
+ return unauthenticatedIdentity;
+ }
+
+ /** Find or create a Group with the given name. Subclasses should use this
+ method to locate the 'Roles' group or create additional types of groups.
+ @return A named Group from the principals set.
+ */
+ protected Group createGroup(String name, Set principals)
+ {
+ Group roles = null;
+ Iterator iter = principals.iterator();
+ while( iter.hasNext() )
+ {
+ Object next = iter.next();
+ if( (next instanceof Group) == false )
+ continue;
+ Group grp = (Group) next;
+ if( grp.getName().equals(name) )
+ {
+ roles = grp;
+ break;
+ }
+ }
+ // If we did not find a group create one
+ if( roles == null )
+ {
+ roles = new SimpleGroup(name);
+ principals.add(roles);
+ }
+ return roles;
+ }
+
+ /** Utility method to create a Principal for the given username. This
+ * creates an instance of the principalClassName type if this option was
+ * specified using the class constructor matching: ctor(String). If
+ * principalClassName was not specified, a SimplePrincipal is created.
+ *
+ * @param username the name of the principal
+ * @return the principal instance
+ * @throws java.lang.Exception thrown if the custom principal type cannot be created.
+ */
+ protected Principal createIdentity(String username)
+ throws Exception
+ {
+ Principal p = null;
+ if( principalClassName == null )
+ {
+ p = new SimplePrincipal(username);
+ }
+ else
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Class clazz = loader.loadClass(principalClassName);
+ Class[] ctorSig = {String.class};
+ Constructor ctor = clazz.getConstructor(ctorSig);
+ Object[] ctorArgs = {username};
+ p = (Principal) ctor.newInstance(ctorArgs);
+ }
+ return p;
+ }
+}
\ No newline at end of file
Index: lams_admin/src/java/org/lamsfoundation/lams/admin/security/AuthenticationMethodConfigurer.java
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/security/Attic/AuthenticationMethodConfigurer.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/src/java/org/lamsfoundation/lams/admin/security/AuthenticationMethodConfigurer.java 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,114 @@
+/*
+ * Created on 2004-12-16
+ *
+ * Last modified on 2004-12-16
+ */
+package org.lamsfoundation.lams.admin.security;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import org.lamsfoundation.lams.usermanagement.AuthenticationMethodParameter;
+import org.lamsfoundation.lams.usermanagement.AuthenticationMethod;
+import org.lamsfoundation.lams.util.XmlFileLoader;
+
+/**
+ * TODO Add description here
+ *
+ *
+
\ No newline at end of file
Index: lams_admin/web/admin/errorContent.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/web/admin/Attic/errorContent.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/web/admin/errorContent.jsp 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
An error has occured
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_admin/web/admin/organisationContent.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_admin/web/admin/Attic/organisationContent.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_admin/web/admin/organisationContent.jsp 10 Feb 2005 03:52:31 -0000 1.1
@@ -0,0 +1,58 @@
+<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
+<%@ page import="org.lamsfoundation.lams.admin.web.OrganisationActionForm" %>
+<%@ taglib uri="/WEB-INF/jstl/c.tld" prefix="c" %>
+<%@ taglib uri="/WEB-INF/struts/struts-html.tld" prefix="html" %>
+
+
+
+
+
+ Organisation Entry
+
+
+ An "organisation" is a grouping of users. It could be a high school, a particular year or a single class.
+ If could be a set of people doing a particular course.
+