Removed cold application code.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2046 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
729b701e08
commit
2d011e2f62
|
|
@ -17,18 +17,14 @@
|
||||||
package com.arsdigita.auth.http;
|
package com.arsdigita.auth.http;
|
||||||
|
|
||||||
import com.arsdigita.db.Sequences;
|
import com.arsdigita.db.Sequences;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.security.*;
|
||||||
import com.arsdigita.kernel.security.HTTPRequestCallback;
|
|
||||||
import com.arsdigita.kernel.security.HTTPResponseCallback;
|
|
||||||
import com.arsdigita.kernel.security.MappingLoginModule;
|
|
||||||
import com.arsdigita.kernel.security.PasswordLoginModule;
|
|
||||||
import com.arsdigita.kernel.security.UserLoginModule;
|
|
||||||
import com.arsdigita.kernel.security.Util;
|
|
||||||
import com.arsdigita.persistence.DataOperation;
|
import com.arsdigita.persistence.DataOperation;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import com.arsdigita.web.RedirectSignal;
|
import com.arsdigita.web.RedirectSignal;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
@ -38,6 +34,7 @@ import java.security.PublicKey;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.security.auth.Subject;
|
import javax.security.auth.Subject;
|
||||||
import javax.security.auth.callback.Callback;
|
import javax.security.auth.callback.Callback;
|
||||||
|
|
@ -46,7 +43,9 @@ import javax.security.auth.login.LoginException;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import sun.misc.BASE64Decoder;
|
import sun.misc.BASE64Decoder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -302,7 +301,8 @@ public class HTTPLoginModule extends MappingLoginModule {
|
||||||
throw new UncheckedWrapperException( e );
|
throw new UncheckedWrapperException( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
String returnURL = "http://" + KernelHelper.getHostName() + req.getRequestURI();
|
String returnURL = "http://" + Web.getConfig().getHost().getName()
|
||||||
|
+ req.getRequestURI();
|
||||||
if( req.getQueryString () != null ) {
|
if( req.getQueryString () != null ) {
|
||||||
returnURL = returnURL + "?" + req.getQueryString ();
|
returnURL = returnURL + "?" + req.getQueryString ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,18 +136,6 @@ public class Loader extends PackageLoader {
|
||||||
*/
|
*/
|
||||||
private void loadPortalSiteApplicationType() {
|
private void loadPortalSiteApplicationType() {
|
||||||
|
|
||||||
/* First try: create a new style, legacy compatible application */
|
|
||||||
|
|
||||||
// ApplicationType type = ApplicationType.createApplicationType(
|
|
||||||
// "portalsite",
|
|
||||||
// "Portal Site",
|
|
||||||
// PortalSite.BASE_DATA_OBJECT_TYPE);
|
|
||||||
// Current code requires an apps specific dispatcher class. Has to be
|
|
||||||
// modified to be able to create a legacy free app type.
|
|
||||||
// type.setDispatcherClass
|
|
||||||
// ("com.arsdigita.portalserver.ui.PortalDispatcher");
|
|
||||||
|
|
||||||
// Try: new style legacy free application
|
|
||||||
ApplicationType type = new
|
ApplicationType type = new
|
||||||
ApplicationType("Portal Site", // title
|
ApplicationType("Portal Site", // title
|
||||||
PortalSite.BASE_DATA_OBJECT_TYPE );
|
PortalSite.BASE_DATA_OBJECT_TYPE );
|
||||||
|
|
@ -251,7 +239,14 @@ public class Loader extends PackageLoader {
|
||||||
// FORMERLY ui.admin.Initializer
|
// FORMERLY ui.admin.Initializer
|
||||||
/**
|
/**
|
||||||
* Creates a PortalCreator, another of the domain classes of the portalserver
|
* Creates a PortalCreator, another of the domain classes of the portalserver
|
||||||
* package, ApplicationType as a legacy-comp type of application type.
|
* package, ApplicationType as a legacy free type of application type.
|
||||||
|
*
|
||||||
|
* NOTE: The wording in the title parameter of ApplicationType determines
|
||||||
|
* the name of the subdirectory for the XSL stylesheets.
|
||||||
|
* It gets "urlized", i.e. trimming leading and trailing blanks and replacing
|
||||||
|
* blanks between words and illegal characters with an hyphen and converted
|
||||||
|
* to lower case.
|
||||||
|
* Example: "Portal Creator" will become "portal-creator".
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void loadPortalCreatorApplicationType() {
|
private void loadPortalCreatorApplicationType() {
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,14 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portalserver.admin;
|
package com.arsdigita.portalserver.admin;
|
||||||
|
|
||||||
import com.arsdigita.web.Application;
|
|
||||||
import com.arsdigita.web.ApplicationCollection;
|
|
||||||
import com.arsdigita.bebop.table.*;
|
|
||||||
import com.arsdigita.bebop.*;
|
import com.arsdigita.bebop.*;
|
||||||
import com.arsdigita.dispatcher.*;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.portalserver.*;
|
|
||||||
import com.arsdigita.portalserver.PortalPage;
|
import com.arsdigita.portalserver.PortalPage;
|
||||||
import com.arsdigita.toolbox.ui.*;
|
import com.arsdigita.portalserver.PortalSite;
|
||||||
import org.apache.log4j.Logger;
|
import com.arsdigita.web.Application;
|
||||||
|
|
||||||
import com.arsdigita.xml.Document;
|
import com.arsdigita.xml.Document;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PSAdminPage
|
* PSAdminPage
|
||||||
|
|
@ -38,12 +34,9 @@ import com.arsdigita.xml.Element;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
|
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
|
||||||
* @version $Revision: #8 $ $Date: 2004/08/17 $
|
* @version $Revision: #8 $ $Date: 2004/08/17 $
|
||||||
|
* @version $ID:PSAdminPage.java, pboy $
|
||||||
*/
|
*/
|
||||||
class PSAdminPage extends PortalPage {
|
class PSAdminPage extends PortalPage {
|
||||||
public static final String versionId =
|
|
||||||
"$Id: //portalserver/dev/src/com/arsdigita/portalserver/admin/ui/AdminPage.java#8 $" +
|
|
||||||
"$Author: dennis $" +
|
|
||||||
"$DateTime: 2004/08/17 23:19:25 $";
|
|
||||||
|
|
||||||
BoxPanel m_bpanel;
|
BoxPanel m_bpanel;
|
||||||
|
|
||||||
|
|
@ -51,6 +44,7 @@ class PSAdminPage extends PortalPage {
|
||||||
(PSAdminPage.class.getName());
|
(PSAdminPage.class.getName());
|
||||||
|
|
||||||
private RequestLocal m_children = new RequestLocal() {
|
private RequestLocal m_children = new RequestLocal() {
|
||||||
|
@Override
|
||||||
public Object initialValue(PageState ps) {
|
public Object initialValue(PageState ps) {
|
||||||
Application app = Application.getCurrentApplication
|
Application app = Application.getCurrentApplication
|
||||||
(DispatcherHelper.getRequest());
|
(DispatcherHelper.getRequest());
|
||||||
|
|
@ -62,6 +56,7 @@ class PSAdminPage extends PortalPage {
|
||||||
getHeader().setIdAttr("admin");
|
getHeader().setIdAttr("admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void buildContextBar() {
|
protected void buildContextBar() {
|
||||||
DimensionalNavbar navbar = new DimensionalNavbar();
|
DimensionalNavbar navbar = new DimensionalNavbar();
|
||||||
|
|
||||||
|
|
@ -77,7 +72,7 @@ class PSAdminPage extends PortalPage {
|
||||||
/**
|
/**
|
||||||
* This method outputs a list of links to admin functionality.
|
* This method outputs a list of links to admin functionality.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void buildBody(Container body) {
|
protected void buildBody(Container body) {
|
||||||
|
|
||||||
m_bpanel = new BoxPanel();
|
m_bpanel = new BoxPanel();
|
||||||
|
|
@ -98,11 +93,11 @@ class PSAdminPage extends PortalPage {
|
||||||
* This method is called by the generateXML() method of the parent
|
* This method is called by the generateXML() method of the parent
|
||||||
* class, and writes a CSS style block into the output.
|
* class, and writes a CSS style block into the output.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addStyleBlock(PageState state, Document parent) {
|
public void addStyleBlock(PageState state, Document parent) {
|
||||||
PortalSite psite = PortalSite.getCurrentPortalSite(state.getRequest());
|
PortalSite psite = PortalSite.getCurrentPortalSite(state.getRequest());
|
||||||
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
buffer.append("<STYLE type=\"text/css\"> <!--");
|
buffer.append("<STYLE type=\"text/css\"> <!--");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class PSAdminServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User extension point, initialize PortalCreator (index) page and add
|
* User extension point, initialize PortalAdmin (index) page and add
|
||||||
* authentication check.
|
* authentication check.
|
||||||
*
|
*
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,14 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
|
||||||
|
// ////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Replaced by PersonalPortalServer and not used anymore
|
||||||
|
//
|
||||||
|
// ////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p><strong>Experimental</strong></p>
|
* <p><strong>Experimental</strong></p>
|
||||||
*
|
*
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
|
* Copyright (C) 2012-2013 University of Bremen. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
|
@ -44,8 +44,11 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Provides the UI for the personal Portal for logged in users.
|
||||||
*
|
*
|
||||||
* @author pb
|
* It replaces the former PersonalPortalDispatcher.
|
||||||
|
*
|
||||||
|
* @author pb <pboy@barkhof.uni-bremen.de>
|
||||||
* @version $Id: PersonalPortalServlet.java pboy $
|
* @version $Id: PersonalPortalServlet.java pboy $
|
||||||
*/
|
*/
|
||||||
public class PersonalPortalServlet extends BaseApplicationServlet {
|
public class PersonalPortalServlet extends BaseApplicationServlet {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
package com.arsdigita.portalserver.pslogin;
|
package com.arsdigita.portalserver.pslogin;
|
||||||
|
|
||||||
// import com.arsdigita.ui.login.SubsiteDispatcher; DELETED!
|
// import com.arsdigita.ui.login.SubsiteDispatcher; DELETED!
|
||||||
import com.arsdigita.kernel.security.Initializer;
|
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.page.BebopMapDispatcher;
|
import com.arsdigita.bebop.page.BebopMapDispatcher;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -30,6 +29,8 @@ import java.util.Map;
|
||||||
// Uses methods in c.ad.kernel.security.Initializer which have been modified
|
// Uses methods in c.ad.kernel.security.Initializer which have been modified
|
||||||
// and moved to ui
|
// and moved to ui
|
||||||
//
|
//
|
||||||
|
// And used to use com.arsdigita.ui.login.SubsiteDispatcher which is deleted.
|
||||||
|
//
|
||||||
// CURRENTLY NOT WORKING
|
// CURRENTLY NOT WORKING
|
||||||
//
|
//
|
||||||
// /////////////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -39,7 +40,13 @@ import java.util.Map;
|
||||||
* This class extends com.arsdigita.ui.login.SubsiteDispatcher
|
* This class extends com.arsdigita.ui.login.SubsiteDispatcher
|
||||||
* It changes the subsite dispatcher behavior by
|
* It changes the subsite dispatcher behavior by
|
||||||
* directing logged-in users to a personal portal
|
* directing logged-in users to a personal portal
|
||||||
* rather than the default system portal
|
* rather than the default system portal.
|
||||||
|
*
|
||||||
|
* NOTE: Comment outdated! SubsiteDispatcher no longer exists. Logged in users
|
||||||
|
* are now redirected using a web.UI function. Class has to adjusted.
|
||||||
|
* Specifically it may not be needed anymore, because the current redirection
|
||||||
|
* mechanism works without it at all.
|
||||||
|
*
|
||||||
* @author <a href="mailto:bryanche@arsdigita.com">Bryan Che</a>
|
* @author <a href="mailto:bryanche@arsdigita.com">Bryan Che</a>
|
||||||
**/
|
**/
|
||||||
// public class PSSubsiteDispatcher extends SubsiteDispatcher {
|
// public class PSSubsiteDispatcher extends SubsiteDispatcher {
|
||||||
|
|
|
||||||
|
|
@ -29,36 +29,51 @@ import com.arsdigita.bebop.event.ActionListener;
|
||||||
|
|
||||||
import com.arsdigita.portalserver.ApplicationPage;
|
import com.arsdigita.portalserver.ApplicationPage;
|
||||||
import com.arsdigita.portalserver.PortalSite;
|
import com.arsdigita.portalserver.PortalSite;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author pb
|
||||||
|
* @version $Id: PortalCreatePage.java#4 $
|
||||||
|
*/
|
||||||
class PortalCreatePage extends ApplicationPage {
|
class PortalCreatePage extends ApplicationPage {
|
||||||
public static final String versionId =
|
|
||||||
"$Id: //portalserver/dev/src/com/arsdigita/portalserver/ui/admin/PortalCreatePage.java#4 $" +
|
|
||||||
"$Author: dennis $" +
|
|
||||||
"$DateTime: 2004/08/17 23:19:25 $";
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public PortalCreatePage() {
|
public PortalCreatePage() {
|
||||||
final RequestLocal portalsiteRL = new RequestLocal();
|
final RequestLocal portalsiteRL = new RequestLocal();
|
||||||
|
|
||||||
// TODO: parent portal selection after basic properties entered
|
// TODO: parent portal selection after basic properties entered
|
||||||
final Component f = PortalCreateForm.
|
final Component f = PortalCreateForm.
|
||||||
create(new RequestLocal(), portalsiteRL, new ActionListener() {
|
create(new RequestLocal(), portalsiteRL, new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState ps = e.getPageState();
|
PageState ps = e.getPageState();
|
||||||
try {
|
try {
|
||||||
com.arsdigita.dispatcher.DispatcherHelper.sendRedirect(
|
com.arsdigita.dispatcher.DispatcherHelper.sendRedirect(
|
||||||
ps.getRequest(), ps.getResponse(),
|
ps.getRequest(),
|
||||||
((PortalSite) portalsiteRL.get(ps)).getSiteNode().getURLNoContext() + "admin/");
|
ps.getResponse(),
|
||||||
} catch (java.io.IOException ex) {
|
// ((PortalSite) portalsiteRL.get(ps)).getPath()
|
||||||
throw
|
// .getSiteNode()
|
||||||
new com.arsdigita.util.UncheckedWrapperException(ex);
|
// .getURLNoContext()
|
||||||
}
|
// TODO: Test whether replacement works !!
|
||||||
}
|
// Compare with version 2.0.x release
|
||||||
});
|
((PortalSite) portalsiteRL.get(ps)).getPath()
|
||||||
|
+ "admin/");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new com.arsdigita.util.UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
add(f);
|
add(f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
protected void buildContextBar() {
|
protected void buildContextBar() {
|
||||||
DimensionalNavbar navbar = new DimensionalNavbar();
|
DimensionalNavbar navbar = new DimensionalNavbar();
|
||||||
navbar.setClassAttr("portalNavbar");
|
navbar.setClassAttr("portalNavbar");
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,10 @@ public class PortalTreeModelBuilder
|
||||||
result.add(new ControlLink(l));
|
result.add(new ControlLink(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
String psURL = psite.getSiteNode().getURL();
|
// String psURL = psite.getSiteNode().getURL();
|
||||||
|
// TODO: Does replacement work??
|
||||||
|
// Compare with version 2.0.x release
|
||||||
|
String psURL = psite.getPath();
|
||||||
result.add(new Label(GlobalizationUtil.globalize("cw.workspace.ui.admin.")));
|
result.add(new Label(GlobalizationUtil.globalize("cw.workspace.ui.admin.")));
|
||||||
Link viewLink = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.ui.admin.view")), psURL);
|
Link viewLink = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.ui.admin.view")), psURL);
|
||||||
viewLink.setTargetFrame(Link.NEW_FRAME);
|
viewLink.setTargetFrame(Link.NEW_FRAME);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>portal-personalportal</servlet-name>
|
<servlet-name>portal-personalportalcreator</servlet-name>
|
||||||
<servlet-class>com.arsdigita.portalserver.personal.PersonalPortalCreatorServlet</servlet-class>
|
<servlet-class>com.arsdigita.portalserver.personal.PersonalPortalCreatorServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
<!-- module ccm-portalserver - servlet declarations END -->
|
<!-- module ccm-portalserver - servlet declarations END -->
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>portal-personalportal</servlet-name>
|
<servlet-name>portal-personalportalcreator</servlet-name>
|
||||||
<url-pattern>/templates/servlet/personal-portal-creator/*</url-pattern>
|
<url-pattern>/templates/servlet/personal-portal-creator/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
<!-- module ccm-portalserver - servlet mappings END -->
|
<!-- module ccm-portalserver - servlet mappings END -->
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.kernel.Group;
|
import com.arsdigita.kernel.Group;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.KernelExcursion;
|
import com.arsdigita.kernel.KernelExcursion;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.PartyCollection;
|
import com.arsdigita.kernel.PartyCollection;
|
||||||
import com.arsdigita.kernel.Role;
|
import com.arsdigita.kernel.Role;
|
||||||
|
|
@ -838,7 +838,7 @@ public class Workspace extends Application {
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
// check that the user is no longer system user
|
// check that the user is no longer system user
|
||||||
Party party = KernelHelper.getCurrentEffectiveParty();
|
Party party = Kernel.getContext().getEffectiveParty();
|
||||||
s_log.debug("party after excurse is " + party.getDisplayName());
|
s_log.debug("party after excurse is " + party.getDisplayName());
|
||||||
|
|
||||||
Role admins = group.getRole("Administrators");
|
Role admins = group.getRole("Administrators");
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.kernel.PackageInstance;
|
import com.arsdigita.kernel.PackageInstance;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
import com.arsdigita.kernel.SiteNode;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
|
|
||||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
|
|
@ -46,40 +46,63 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
public class SimpleSurveyUtil {
|
public class SimpleSurveyUtil {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static SiteNode getSiteNode(HttpServletRequest request) {
|
public static SiteNode getSiteNode(HttpServletRequest request) {
|
||||||
|
|
||||||
SiteNode siteNode;
|
SiteNode siteNode;
|
||||||
try {
|
try {
|
||||||
siteNode = SiteNode.getSiteNode(request.getRequestURI().toString(), true);
|
siteNode = SiteNode.getSiteNode(request.getRequestURI().toString(), true);
|
||||||
} catch (com.arsdigita.domain.DataObjectNotFoundException e) {
|
} catch (com.arsdigita.domain.DataObjectNotFoundException e) {
|
||||||
throw new com.arsdigita.util.UncheckedWrapperException(e);
|
throw new com.arsdigita.util.UncheckedWrapperException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return siteNode;
|
return siteNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pageState
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static SiteNode getSiteNode(PageState pageState) {
|
public static SiteNode getSiteNode(PageState pageState) {
|
||||||
return getSiteNode(pageState.getRequest());
|
return getSiteNode(pageState.getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pageState
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static PackageInstance getPackageInstance(PageState pageState) {
|
public static PackageInstance getPackageInstance(PageState pageState) {
|
||||||
|
return getSiteNode(pageState).getPackageInstance();
|
||||||
return getSiteNode(pageState).getPackageInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pageState
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static boolean isUserAdmin(PageState pageState) {
|
public static boolean isUserAdmin(PageState pageState) {
|
||||||
boolean admin_p = false;
|
boolean admin_p = false;
|
||||||
|
|
||||||
User user = KernelHelper.getCurrentUser(pageState.getRequest());
|
User user = (User)Kernel.getContext().getParty();
|
||||||
|
|
||||||
SiteNode siteNode = SimpleSurveyUtil.getSiteNode(pageState);
|
SiteNode siteNode = SimpleSurveyUtil.getSiteNode(pageState);
|
||||||
|
|
||||||
PermissionDescriptor admin = new PermissionDescriptor
|
PermissionDescriptor admin = new PermissionDescriptor
|
||||||
(PrivilegeDescriptor.ADMIN, siteNode, user);
|
(PrivilegeDescriptor.ADMIN,
|
||||||
|
siteNode,
|
||||||
|
user);
|
||||||
|
|
||||||
if (PermissionService.checkPermission(admin)) {
|
if (PermissionService.checkPermission(admin)) {
|
||||||
admin_p = true;
|
admin_p = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return admin_p;
|
return admin_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.simplesurvey.Survey;
|
import com.arsdigita.simplesurvey.Survey;
|
||||||
|
|
||||||
import com.arsdigita.simplesurvey.util.GlobalizationUtil;
|
import com.arsdigita.simplesurvey.util.GlobalizationUtil;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
@ -94,8 +94,9 @@ public class ResultsPane extends SimpleContainer {
|
||||||
};
|
};
|
||||||
|
|
||||||
m_user = new RequestLocal() {
|
m_user = new RequestLocal() {
|
||||||
|
@Override
|
||||||
public Object initialValue(PageState ps) {
|
public Object initialValue(PageState ps) {
|
||||||
User user = KernelHelper.getCurrentUser(ps.getRequest());
|
User user = (User)Kernel.getContext().getParty();
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,40 +19,34 @@
|
||||||
package com.arsdigita.simplesurvey.ui;
|
package com.arsdigita.simplesurvey.ui;
|
||||||
|
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterData;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.formbuilder.PersistentComponent;
|
import com.arsdigita.formbuilder.PersistentComponent;
|
||||||
import com.arsdigita.formbuilder.PersistentForm;
|
import com.arsdigita.formbuilder.PersistentForm;
|
||||||
import com.arsdigita.formbuilder.PersistentLabel;
|
import com.arsdigita.formbuilder.PersistentLabel;
|
||||||
import com.arsdigita.formbuilder.PersistentWidget;
|
import com.arsdigita.formbuilder.PersistentWidget;
|
||||||
|
import com.arsdigita.formbuilder.util.FormBuilderUtil;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
|
||||||
import com.arsdigita.persistence.OID;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import com.arsdigita.bebop.FormData;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.RequestLocal;
|
|
||||||
|
|
||||||
import com.arsdigita.simplesurvey.Survey;
|
|
||||||
import com.arsdigita.simplesurvey.Response;
|
|
||||||
import com.arsdigita.bebop.RequestLocal;
|
|
||||||
import com.arsdigita.simplesurvey.ui.Question;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterData;
|
|
||||||
import com.arsdigita.persistence.DataAssociationCursor;
|
import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
import com.arsdigita.persistence.DataOperation;
|
import com.arsdigita.persistence.DataOperation;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import java.util.Iterator;
|
import com.arsdigita.simplesurvey.Response;
|
||||||
|
import com.arsdigita.simplesurvey.Survey;
|
||||||
import com.arsdigita.formbuilder.util.FormBuilderUtil;
|
|
||||||
|
|
||||||
import com.arsdigita.kernel.User;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,7 +102,7 @@ public class SurveyProcessListener
|
||||||
m_persistentForm.set(ps, survey.getForm());
|
m_persistentForm.set(ps, survey.getForm());
|
||||||
|
|
||||||
// Get the responding user
|
// Get the responding user
|
||||||
User user = KernelHelper.getCurrentUser(ps.getRequest());
|
User user = (User)Kernel.getContext().getParty();
|
||||||
|
|
||||||
// Use the generic user "The Public" if the user is not registered
|
// Use the generic user "The Public" if the user is not registered
|
||||||
if ( user == null) {
|
if ( user == null) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ package com.arsdigita.simplesurvey.ui;
|
||||||
import com.arsdigita.simplesurvey.util.GlobalizationUtil ;
|
import com.arsdigita.simplesurvey.util.GlobalizationUtil ;
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.kernel.KernelHelper;
|
import com.arsdigita.kernel.Kernel;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
@ -115,7 +115,7 @@ public class ViewPanel extends SimpleContainer {
|
||||||
//s_log.warn("HEY responseID=" + responseID);
|
//s_log.warn("HEY responseID=" + responseID);
|
||||||
if ( responseID == null ) {
|
if ( responseID == null ) {
|
||||||
|
|
||||||
User user = KernelHelper.getCurrentUser(ps.getRequest());
|
User user = (User)Kernel.getContext().getParty();
|
||||||
if ( user == null) {
|
if ( user == null) {
|
||||||
try {
|
try {
|
||||||
user = User.retrieve(THE_PUBLIC_USER);
|
user = User.retrieve(THE_PUBLIC_USER);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue