Weitere Old Initializer ausgebaut.

ACHTUNG:

In ~/bundle/cfg/integration.properties muss geaendert werden:

waf.pagemap.root=navigation/
waf.pagemap.workspace=navigation/
waf.pagemap.login_redirect=content/content-center-redirect.jsp

in

core.ui.pagemap.root_page_url=navigation/
core.ui.pagemap.workspace_url=navigation/
core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp

Ansonsten gibt es gleich beim Aufruf der ersten Seite ein Resource Not Fount.


git-svn-id: https://svn.libreccm.org/ccm/trunk@742 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-02-10 08:46:11 +00:00
parent 48b8c77d0e
commit 8ffa7bddc1
51 changed files with 1477 additions and 696 deletions

View File

@ -26,7 +26,7 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.ui.UI;
import com.arsdigita.xml.Element;
/**
@ -44,8 +44,7 @@ public class ContentSectionNavbar extends CMSContainer {
setClassAttr("section");
String wsUrl =
"/" + LegacyInitializer.getURL(LegacyInitializer.WORKSPACE_PAGE_KEY);
String wsUrl = UI.getWorkspaceURL();
String csUrl = Utilities.getWorkspaceURL();
m_navbar = new DimensionalNavbar();

View File

@ -22,7 +22,8 @@ import com.arsdigita.bebop.DimensionalNavbar;
import com.arsdigita.bebop.Link;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.ui.UI;
/**
* Delimited dimensional navbar.
@ -39,8 +40,10 @@ public class GlobalNavbar extends DimensionalNavbar {
// FIXME: Write online help, for the time being offer no link
// add(new Link("Help", "help"));
//String signOutURL = Utilities.getWebappContext() + "/" +
// LegacyInitializer.getURL(LegacyInitializer.LOGOUT_PAGE_KEY);
String signOutURL = Utilities.getWebappContext() + "/" +
LegacyInitializer.getURL(LegacyInitializer.LOGOUT_PAGE_KEY);
UI.getLogoutPageURL();
add(new Link((String) globalize("cms.ui.sign_out").localize(),
signOutURL));

View File

@ -22,7 +22,7 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.ui.UI;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
@ -47,11 +47,12 @@ class GlobalNavigation extends SimpleComponent {
GlobalNavigation() {
m_centerPath = Utilities.getWorkspaceURL();
m_wspcPath = path(LegacyInitializer.WORKSPACE_PAGE_KEY);
m_signOutPath = path(LegacyInitializer.LOGOUT_PAGE_KEY);
m_wspcPath = UI.getWorkspaceURL();
m_signOutPath = UI.getLogoutPageURL();
m_helpPath = "/nowhere"; // We don't have this yet XXX.
}
@Override
public void generateXML(final PageState state, final Element parent) {
if (isVisible(state)) {
final HttpServletRequest sreq = state.getRequest();
@ -71,10 +72,6 @@ class GlobalNavigation extends SimpleComponent {
}
}
private static String path(final String key) {
return "/" + LegacyInitializer.getURL(key);
}
private static Element link(final HttpServletRequest sreq,
final Element parent,
final String name,

View File

@ -161,7 +161,7 @@ public class SecurityPropertyEditor extends PropertyEditor {
addSecurityListener(section);
} else {
throw new IllegalArgumentException(
"The ComponentAccess object did not contain a form section.");
"The ComponentAccess object did not contain a form section.");
}
}

View File

@ -1,13 +1,13 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.kernel.security.LegacyInitializer"/>
<jsp:directive.page import="com.arsdigita.ui.UI"/>
<jsp:directive.page import="com.arsdigita.web.URL"/>
<jsp:directive.page import="com.arsdigita.web.RedirectSignal"/>
<jsp:directive.page extends="com.arsdigita.web.BaseJSP"/>
<jsp:directive.page import="com.arsdigita.cms.ContentSection"/>
<jsp:directive.page import="com.arsdigita.cms.ContentSectionCollection"/>
<jsp:directive.page import="com.arsdigita.cms.SecurityManager"/>
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
<jsp:directive.page extends="com.arsdigita.web.BaseJSP"/>
<jsp:scriptlet>
ContentSectionCollection sections = ContentSection.getAllSections();
@ -26,7 +26,7 @@
if (hasAccess) {
url = Utilities.getWorkspaceURL();
} else {
url = LegacyInitializer.getFullURL(LegacyInitializer.WORKSPACE_PAGE_KEY, request);
url = UI.getWorkspaceURL(request);
}
throw new RedirectSignal(URL.there(request, url), false);

View File

@ -27,8 +27,8 @@ import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException;
/**
* The parent of all Bebop Link classes, this class represents a URL
* on a page. It may contain a label, an image, or any other component.
* The parent of all Bebop Link classes, this class represents a URL on a page.
* It may contain a label, an image, or any other component.
*
* <p> The following table lists all Bebop Link classes and suggests
* when they might be used.
@ -60,7 +60,9 @@ import com.arsdigita.util.UncheckedWrapperException;
* </tr>
* <tr>
* <td>{@link ActionLink}</td>
* <td>Sets its own control event and runs its own {@link com.arsdigita.bebop.event.ActionListener}s. When the link is clicked, the code in the Listener's <tt>actionPerformed</tt> method runs.</td>
* <td>Sets its own control event and runs its own
* {@link com.arsdigita.bebop.event.ActionListener}s. When the link is clicked,
* the code in the Listener's <tt>actionPerformed</tt> method runs.</td>
* </tr>
* <tr>
* <td>{@link ToggleLink}</td>
@ -90,16 +92,34 @@ public abstract class BaseLink extends TextStylable
private String m_sConfirmMsg = "";
/**
* Constructor
*
* @param child label component, text, image, etc.
* @param url
*/
public BaseLink(Component child, String url) {
super();
m_url = url;
m_child = child;
}
/**
* Constructor.
*
* @param label as text
* @param url
*/
public BaseLink(String label, String url) {
this(new Label(label), url);
}
/**
* Constructor.
*
* @param child
* @param l
*/
public BaseLink(Component child, PrintListener l) {
this(child, "");
try {
@ -110,10 +130,21 @@ public abstract class BaseLink extends TextStylable
}
}
/**
* Constructor.
*
* @param label
* @param l
*/
public BaseLink(String label, PrintListener l) {
this(new Label(label), l);
}
/**
* Constructor.
*
* @param l
*/
public BaseLink(PrintListener l) {
this("", l);
}

View File

@ -28,8 +28,8 @@ import com.arsdigita.web.ParameterMap;
import org.apache.log4j.Logger;
/**
* A URL on a page. May contain a label, an image,
* or any other component. A Link is a BaseLink that manages URL variables.
* A URL on a page. May contain a label, an image, or any other component.
* A Link is a BaseLink that manages URL variables.
*
* <p> <b>Example:</b> The common usage for a Link component is
* illustrated in the code fragment below:
@ -63,9 +63,9 @@ public class Link extends BaseLink {
protected final String TYPE_LINK = "link";
/**
* <p>Passing this value to {@link #setTargetFrame setTargetFrame}
* will create a link that opens a new browser window whenever it
* is clicked.</p>
* <p>Passing this value to {@link #setTargetFrame setTargetFrame} will
* create a link that opens a new browser window whenever it is clicked.
*</p>
*
* @see #setTargetFrame
*/
@ -77,18 +77,19 @@ public class Link extends BaseLink {
}
/**
* <p>The <tt>Component</tt> parameter in this constructor is
* usually a {@link Label} or {@link Image}.</p>
* Constructor.
*
* <p>Starting with release 5.2, this method prefixes the
* passed-in <code>url</code> with the path to the CCM dispatcher.
* Code using this constructor should not prefix <code>url</code>
* with the webapp context path or the dispatcher servlet
* path.</p>
* <p>The <tt>Component</tt> parameter in this constructor is usually a
* {@link Label} or {@link Image}.</p>
*
* <p>The vast majority of CCM UI code expects to link through the
* dispatcher. Code that does not should use the
* <code>Link</code> constructor taking a <code>URL</code>.</p>
* <p>Starting with release 5.2, this method prefixes the passed-in url with
* the path to the CCM dispatcher. Code using this constructor should not
* prefix <code>url</code> with the webapp context path or the dispatcher
* servlet path.</p>
*
* <p>The vast majority of CCM UI code expects to link through the dispatcher.
* Code that does not should use the <code>Link</code> constructor taking
* a <code>URL</code>.</p>
*
* @see #Link(String,URL)
*/
@ -99,12 +100,11 @@ public class Link extends BaseLink {
}
/**
* Constructors with <tt>PrintListener</tt> parameters
* allow for a {@link PrintListener} to be set for
* the Link, without the need to make a separate call to
* the <tt>addPrintListener</tt> method. PrintListeners
* are a convenient way to alter underlying Link attributes
* such as Link text or target URL within a locked page
* Constructors with <tt>PrintListener</tt> parameters allow for a
* {@link PrintListener} to be set for the Link, without the need
* to make a separate call to the <tt>addPrintListener</tt> method.
* PrintListeners are a convenient way to alter underlying Link
* attributes such as Link text or target URL within a locked page
* on a per request basis.
*/
public Link(Component child, PrintListener l) {
@ -113,12 +113,30 @@ public class Link extends BaseLink {
init();
}
/**
* Constructors with <tt>PrintListener</tt> parameters allow for a
* {@link PrintListener} to be set for the Link, without the need to make a
* separate call to the <tt>addPrintListener</tt> method. PrintListeners
* are a convenient way to alter underlying Link attributes such as Link
* text or target URL within a locked page on a per request basis.
*/
public Link(String label, PrintListener l) {
super(label,l);
init();
}
/**
* Constructors with <tt>PrintListener</tt> parameters
* allow for a {@link PrintListener} to be set for
* the Link, without the need to make a separate call to
* the <tt>addPrintListener</tt> method. PrintListeners
* are a convenient way to alter underlying Link attributes
* such as Link text or target URL within a locked page
* on a per request basis.
*/
public Link(PrintListener l) {
super(l);
@ -126,9 +144,9 @@ public class Link extends BaseLink {
}
/**
* <p>This constructor is a common one for a Link component, as it
* allows for the Link text and the target URL to be set at the
* same time during construction.</p>
* <p>This constructor is a common one for a Link component, as it allows
* for the Link text and the target URL to be set at the same time during
* construction.</p>
*
* <p>Starting with release 5.2, this method prefixes the
* passed-in <code>url</code> with the path to the CCM dispatcher.
@ -149,11 +167,10 @@ public class Link extends BaseLink {
}
/**
* <p>Constructs a Link using a <code>URL</code>. When this
* constructor is used, the method {@link #setVar(String,String)}
* and its deprecated equivalent have no effect on the resulting
* hyperlink. Instead, use the <code>ParameterMap</code> argument
* to <code>URL</code>.</p>
* <p>Constructs a Link using a <code>URL</code>. When this constructor is
* used, the method {@link #setVar(String,String)} and its deprecated
* equivalent have no effect on the resulting hyperlink. Instead, use the
* <code>ParameterMap</code> argument to <code>URL</code>.</p>
*
* @see com.arsdigita.web.URL
* @see com.arsdigita.web.ParameterMap

View File

@ -31,10 +31,10 @@ import org.apache.log4j.Logger;
import org.xml.sax.helpers.DefaultHandler;
/**
* Common base class for a generic URL-to-Bebop-Page dispatching
* pattern. This class may be used directly by applications, or it
* may be subclassed to be coded with a specific map or to override
* the map lookup for certain sets of URLs.
* Common base class for a generic URL-to-Bebop-Page dispatching pattern.
* This class may be used directly by applications, or it may be subclassed
* to be coded with a specific map or to override the map lookup for certain
* sets of URLs.
*
* @version $Id: BebopMapDispatcher.java 287 2005-02-22 00:29:02Z sskracic $
*/

View File

@ -86,6 +86,7 @@ public class Initializer extends CompoundInitializer {
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
add(new com.arsdigita.ui.Initializer());
add(new com.arsdigita.kernel.Initializer());
add(new com.arsdigita.kernel.security.Initializer());
add(new com.arsdigita.portal.Initializer());
add(new com.arsdigita.search.Initializer());

View File

@ -35,28 +35,40 @@ init com.arsdigita.globalization.LegacyInitializer {
defaultCharset = "UTF-8";
}
init com.arsdigita.kernel.Initializer {}
init com.arsdigita.kernel.security.LegacyInitializer {
securityHelperClass = "com.arsdigita.kernel.security.DefaultSecurityHelper";
sessionTrackingMethod = "cookie";
excludedExtensions = { ".jpg", ".gif", ".png", ".pdf" };
// Should get integrated into the same configuration file as parameter
// waf.debug, i.e. ccm-core/kernel.properties.
init com.arsdigita.webdevsupport.Initializer {
active = false;
}
// /////////////////////////////////////////////////////////////////
//
// Initializer definitely replaced by new initialization system
//
// /////////////////////////////////////////////////////////////////
// Move configuration options to enterprise.init.nolongerInUse
// init com.arsdigita.kernel.LegacyInitializer {}
// -init com.arsdigita.kernel.security.LegacyInitializer {
// - securityHelperClass = "com.arsdigita.kernel.security.DefaultSecurityHelper";
// - sessionTrackingMethod = "cookie";
// -
// - excludedExtensions = { ".jpg", ".gif", ".png", ".pdf" };
// -
// -}
// Set to true when using intermedia search
//-init com.arsdigita.mimetypes.LegacyMimeTypeInitializer {
//- INSOFilterEnabled = false;
//-}
// Should get integrated into the same configuration file as parameter
// waf.debug, i.e. ccm-core/kernel.properties.
init com.arsdigita.webdevsupport.Initializer {
active = false;
}
// init com.arsdigita.toolbox.CharsetEncodingProviderInitializer { }
@ -141,15 +153,6 @@ init com.arsdigita.webdevsupport.Initializer {
// };
// }
// /////////////////////////////////////////////////////////////////
//
// Initializer definitely replaced by new initialization system
//
// /////////////////////////////////////////////////////////////////
// Move configuration options to enterprise.init.nolongerInUse
// no longer used - old versioning system?
// init com.arsdigita.versioning.Initializer { }

View File

@ -26,13 +26,26 @@ import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServlet;
// ////////////////////////////////////////////////////////////////////////
//
// Presumably outdated - part of the old enterprise.ini based initializer
// system.
// Not used in web.xml now and superseded by the new initializer system and
// its legacy init method.
//
// ////////////////////////////////////////////////////////////////////////
/**
* Bootstraps the ACS by calling the initializers in the enterprise.init file.
*
* @author Raphael Schloming (rhs@mit.edu)
* @version $Id: InitializerServlet.java 287 2005-02-22 00:29:02Z sskracic $
* @deprecated without direct replacement. Not used anymore
*/
public class InitializerServlet extends HttpServlet {
private Script m_ini = null;

View File

@ -233,7 +233,6 @@ public class MapDispatcher implements Dispatcher {
public void requireTrailingSlash(String url) { }
/**
*
* Initializes URL-to-Page/Dispatcher/Servlet mappings from a file.
*
* Format of the file is XML:
@ -322,12 +321,14 @@ public class MapDispatcher implements Dispatcher {
m_buffer = new StringBuffer();
}
@Override
public void characters(char[] ch, int start, int len) {
for (int i = 0; i < len; i++) {
m_buffer.append(ch[start + i]);
}
}
@Override
public void endElement(String uri, String localName, String qname) {
if (qname.equals("url")) {
m_url = m_buffer.toString().trim();

View File

@ -10,8 +10,12 @@
Automatically manage data model upgrade process.
</p>
<p>
As of APLAWS 1.0.5 / CCM 6.5 seems to no loner in use.
Configuration file: WEB-INF/resources/core-dmi.xml
</p>
<p>
As of APLAWS 1.0.5 / CCM 6.5 seems to no longer in use.
</p>
</body>

View File

@ -277,9 +277,11 @@ public class GlobalizedMessage {
}
/**
* <p>
* For debugging, not for localizing.
* </p>
* <p>For debugging, not for localizing!</p>
*
* If you need a String, use an additional localize() to get an object
* and cast it to String. e.g.
* String label = (String) GlobalizedMessage(key,bundleName).localize();
*
* @return The contents in String form for debugging.
*/

View File

@ -1,5 +1,4 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -16,98 +15,106 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.kernel;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.initializer.Configuration;
import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.GenericInitializer;
import org.apache.log4j.Logger;
/**
* Initializes the Kernel and bootstraps the rest of the system.
* Initializes the kernel subpackage recurringly each system boot.
*
* @version $Revision: #39 $ $Date: 2004/08/16 $
* @version $Id: Initializer.java 1169 2006-06-14 13:08:25Z fabrice $
* @author pb
*/
public class Initializer extends BaseInitializer {
public class Initializer extends GenericInitializer {
private static final Logger s_log = Logger.getLogger(Initializer.class);
/** Creates a s_logging category with name = to the full name of class */
public static final Logger s_log = Logger.getLogger(Initializer.class);
private Configuration m_conf = new Configuration();
public Configuration getConfiguration() {
return m_conf;
}
/**
* Implementation of the {@link Initializer#init(DomainInitEvent)}
* method.
*
* @param evt The domain init event.
*/
@Override
public void init(DomainInitEvent evt) {
s_log.debug("kernel security domain init begin.");
protected void doStartup() {
setupDomainFactory();
setupURLService();
// Steps carried over from the old style initializer / enterprise.ini
TransactionContext txn = SessionManager.getSession()
.getTransactionContext();
txn.beginTxn();
// Initialize privilege descriptors used in permissions service
s_log.debug("Initializing privilege descriptors...");
PrivilegeDescriptor.initialize();
s_log.debug("Done.");
txn.commitTxn();
}
private void setupDomainFactory() {
DomainObjectInstantiator instantiator;
/*** ACSObject ***/
/* ** ACSObject ** */
// register instantiator for ACSObject data object type
instantiator = new ACSObjectInstantiator();
DomainObjectFactory.registerInstantiator(ACSObject.BASE_DATA_OBJECT_TYPE,
instantiator);
// OLD Initializer code
// instantiator = new ACSObjectInstantiator();
// DomainObjectFactory.registerInstantiator(ACSObject.BASE_DATA_OBJECT_TYPE,
// instantiator);
evt.getFactory().registerInstantiator
(ACSObject.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() );
/*** Party ***/
/* ** Party ** */
// We use the same instantiator as for ACSObject because party is
// abstract so we don't need to override doNewInstance().
DomainObjectFactory.registerInstantiator(Party.BASE_DATA_OBJECT_TYPE,
instantiator);
//DomainObjectFactory.registerInstantiator(Party.BASE_DATA_OBJECT_TYPE,
// instantiator);
evt.getFactory().registerInstantiator
(Party.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() );
/*** User ***/
instantiator = new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new User(dataObject);
}
};
DomainObjectFactory.registerInstantiator
(User.BASE_DATA_OBJECT_TYPE, instantiator);
/* ** User ** */
evt.getFactory().registerInstantiator
(User.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dobj) {
return new User(dobj);
}
} );
/*** Group ***/
instantiator = new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new Group(dataObject);
}
};
DomainObjectFactory.registerInstantiator(Group.BASE_DATA_OBJECT_TYPE,
instantiator);
/* ** Group ** */
// OLD IOnitializer code
// instantiator = new ACSObjectInstantiator() {
// public DomainObject doNewInstance(DataObject dataObject) {
// return new Group(dataObject);
// }
// };
// DomainObjectFactory.registerInstantiator(Group.BASE_DATA_OBJECT_TYPE,
// instantiator);
evt.getFactory().registerInstantiator
(Group.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dobj) {
return new Group(dobj);
}
} );
/*** Role ***/
instantiator = new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new Role(dataObject);
}
};
DomainObjectFactory.registerInstantiator(Role.BASE_DATA_OBJECT_TYPE,
instantiator);
}
// instantiator = new DomainObjectInstantiator() {
// public DomainObject doNewInstance(DataObject dataObject) {
// return new Role(dataObject);
// }
// };
// DomainObjectFactory.registerInstantiator(Role.BASE_DATA_OBJECT_TYPE,
// instantiator);
evt.getFactory().registerInstantiator
(Role.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dobj) {
return new Role(dobj);
}
} );
/* Register URLFinders with the URLService */
private void setupURLService() {
/* Register URLFinders with the URLService */
// PackageInstance is the only kernel object type for which kernel
// can provide a URLFinder. Other object types could have
// finders registered for them by other initializers (in UI packages).
@ -115,9 +122,23 @@ public class Initializer extends BaseInitializer {
// the site map.
URLService.registerFinder(PackageInstance.BASE_DATA_OBJECT_TYPE,
new GenericURLFinder(""));
// READ-ONLY operation, during initializing a transaction should not
// requirred.
//TransactionContext txn = SessionManager.getSession()
// .getTransactionContext();
//txn.beginTxn();
s_log.debug("Initializing privilege descriptors...");
// Initialize privilege descriptors used in permissions service
// Recurring task, reads from database and stores in an internal Map
// field.
PrivilegeDescriptor.initialize();
s_log.debug("Done.");
//txn.commitTxn();
s_log.debug("kernel security domain init completed");
}
protected void doShutdown() {
// Empty
}
}

View File

@ -0,0 +1,127 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.kernel;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.initializer.Configuration;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import org.apache.log4j.Logger;
/**
* Initializes the Kernel and bootstraps the rest of the system.
*
* @version $Revision: #39 $ $Date: 2004/08/16 $
* @version $Id: Initializer.java 1169 2006-06-14 13:08:25Z fabrice $
*/
public class LegacyInitializer extends BaseInitializer {
private static final Logger s_log = Logger.getLogger(LegacyInitializer.class);
private Configuration m_conf = new Configuration();
public Configuration getConfiguration() {
return m_conf;
}
protected void doStartup() {
// MOVED to new type Initializer
// setupDomainFactory();
// setupURLService();
TransactionContext txn = SessionManager.getSession()
.getTransactionContext();
txn.beginTxn();
s_log.debug("Initializing privilege descriptors...");
// Initialize privilege descriptors used in permissions service
// Recurring task, reads from database and stores in an internal Map
// field.
PrivilegeDescriptor.initialize();
s_log.debug("Done.");
txn.commitTxn();
}
private void setupDomainFactory() {
DomainObjectInstantiator instantiator;
/*** ACSObject ***/
// register instantiator for ACSObject data object type
instantiator = new ACSObjectInstantiator();
DomainObjectFactory.registerInstantiator(ACSObject.BASE_DATA_OBJECT_TYPE,
instantiator);
/*** Party ***/
// We use the same instantiator as for ACSObject because party is
// abstract so we don't need to override doNewInstance().
DomainObjectFactory.registerInstantiator(Party.BASE_DATA_OBJECT_TYPE,
instantiator);
/*** User ***/
instantiator = new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new User(dataObject);
}
};
DomainObjectFactory.registerInstantiator
(User.BASE_DATA_OBJECT_TYPE, instantiator);
/*** Group ***/
instantiator = new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new Group(dataObject);
}
};
DomainObjectFactory.registerInstantiator(Group.BASE_DATA_OBJECT_TYPE,
instantiator);
/*** Role ***/
instantiator = new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new Role(dataObject);
}
};
DomainObjectFactory.registerInstantiator(Role.BASE_DATA_OBJECT_TYPE,
instantiator);
}
/* Register URLFinders with the URLService */
private void setupURLService() {
// PackageInstance is the only kernel object type for which kernel
// can provide a URLFinder. Other object types could have
// finders registered for them by other initializers (in UI packages).
// For PackageInstance, urls are determined from the mount points on
// the site map.
URLService.registerFinder(PackageInstance.BASE_DATA_OBJECT_TYPE,
new GenericURLFinder(""));
}
protected void doShutdown() {
// Empty
}
}

View File

@ -39,11 +39,10 @@ import org.apache.log4j.Logger;
*
* @author Phong Nguyen
* @version 1.0
* @version $Id: Party.java 738 2005-09-01 12:36:52Z sskracic $
**/
public abstract class Party extends ACSObject {
public static final String versionId = "$Id: Party.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger( Party.class );
/**
@ -55,6 +54,7 @@ public abstract class Party extends ACSObject {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.kernel.Party";
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
@ -143,6 +143,7 @@ public abstract class Party extends ACSObject {
*
* @see ACSObject#getDisplayName()
*/
@Override
public String getDisplayName() {
return getName();
}

View File

@ -328,6 +328,7 @@ public class PrivilegeDescriptor {
/**
* Initializes the PrivilegeDescriptor's internal cache of privileges.
* Reads privileges from database and stores in the internal Map s_privs.
* Called from the kernel initializer.
*/
public static void initialize() {

View File

@ -18,6 +18,8 @@
*/
package com.arsdigita.kernel.security;
import com.arsdigita.ui.UI;
import javax.servlet.http.HttpServletRequest;
/**
@ -40,13 +42,14 @@ public class DefaultSecurityHelper implements SecurityHelper {
return req.isSecure();
}
private static String[] allowedPages = new String[] {
LegacyInitializer.LOGIN_PAGE_KEY,
LegacyInitializer.LOGOUT_PAGE_KEY,
LegacyInitializer.COOKIES_PAGE_KEY,
LegacyInitializer.RECOVER_PAGE_KEY,
LegacyInitializer.EXPIRED_PAGE_KEY,
};
// NOT USED anymore, see method requiresLogin() belows.
// private static String[] allowedPages = new String[] {
// LegacyInitializer.LOGIN_PAGE_KEY,
// LegacyInitializer.LOGOUT_PAGE_KEY,
// LegacyInitializer.COOKIES_PAGE_KEY,
// LegacyInitializer.RECOVER_PAGE_KEY,
// LegacyInitializer.EXPIRED_PAGE_KEY,
// };
/**
* Determines whether the current request requires that the user be
@ -83,6 +86,7 @@ public class DefaultSecurityHelper implements SecurityHelper {
* @return the full URL of the login page.
**/
public String getLoginURL(HttpServletRequest req) {
return LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_PAGE_KEY, req);
// return LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_PAGE_KEY, req);
return UI.getLoginPageURL();
}
}

View File

@ -25,14 +25,9 @@ import com.arsdigita.runtime.GenericInitializer;
import com.arsdigita.util.URLRewriter;
import java.util.Arrays;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.Iterator;
import java.util.List;
//import java.util.Map;
import javax.security.auth.login.LoginException;
//import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
@ -55,6 +50,7 @@ public class Initializer extends GenericInitializer {
*
* @param evt The domain init event.
*/
@Override
public void init(DomainInitEvent evt) {
s_log.debug("kernel security domain init begin.");
@ -66,9 +62,9 @@ public class Initializer extends GenericInitializer {
URLRewriter.addParameterProvider(new SecurityParameterProvider());
// Step 2:
// TODO: Implement an equivalant to loadExcludedExtensions() of
// LegacyInitializer to set the list of ExludecExtensions in Util!
// Avoid any reference to the config object in Util.
// Implement an equivalant to loadExcludedExtensions() of
// LegacyInitializer to set the list of ExludecExtensions
// Implemented in Util!
// Step 3:
// Set the SecurityHelper class to be used.
@ -89,7 +85,7 @@ public class Initializer extends GenericInitializer {
// Step 4:
// LoadPageMap / handling of URL's. Not an initializer task.
// Has to be handled anywhere else (e.g. com arsdigita.ui)
// Moved to com arsdigita.ui.UI
// Step 5:
loadLoginConfig();

View File

@ -20,7 +20,7 @@ package com.arsdigita.kernel.security;
// import com.arsdigita.util.URLRewriter;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.SiteNode;
// import com.arsdigita.kernel.SiteNode;
import com.arsdigita.initializer.Configuration;
import com.arsdigita.initializer.InitializationException;
@ -31,7 +31,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
// import javax.security.auth.login.LoginException;
import javax.servlet.http.HttpServletRequest;
// import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
@ -298,39 +298,39 @@ public class LegacyInitializer
return (String)s_pageMap.get(key);
}
/**
* Returns the absolute URL associated with the given key. This is the
* root URL for the system (the mount point) prepended to the result of
* getURL(key).
*
* @return the absolute URL associated with the given key, or null
* if it does not exist.
*
* @see #getURL(String)
**/
public static String getFullURL(String key, HttpServletRequest req) {
String root = getRootURL(req);
String url = getURL(key);
// /**
// * Returns the absolute URL associated with the given key. This is the
// * root URL for the system (the mount point) prepended to the result of
// * getURL(key).
// *
// * @return the absolute URL associated with the given key, or null
// * if it does not exist.
// *
// * @see #getURL(String)
// **/
// public static String getFullURL(String key, HttpServletRequest req) {
// String root = getRootURL(req);
// String url = getURL(key);
//
// if (s_log.isDebugEnabled()) {
// s_log.debug("Root is " + root + ", url is " + url);
// }
//
// if ((root == null) || (key == null)) {
// return null;
// }
// return root + url;
// }
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + root + ", url is " + url);
}
if ((root == null) || (key == null)) {
return null;
}
return root + url;
}
private static String getRootURL(HttpServletRequest req) {
// private static String getRootURL(HttpServletRequest req) {
// XXX this isn't safe since you aren't neccessarily
// calling it from the root webapp - so we can't
// blindly prepend the context path from the current
// request.
//return SiteNode.getRootSiteNode().getURL(req);
return SiteNode.getRootSiteNode().getURL();
}
// return SiteNode.getRootSiteNode().getURL();
// }
// private void loadLoginConfig() throws InitializationException {
// javax.security.auth.login.Configuration.setConfiguration

View File

@ -53,15 +53,18 @@ public class SecurityConfig extends AbstractConfig {
private static String s_systemAdministratorEmailAddress = null;
/** Size of secret key in bytes. **/
public static int SECRET_KEY_BYTES = 16;
/** The class name of the SecurityHelper implementation. Must implement
SecurityHelper interface */
private final Parameter m_securityHelperClass = new SpecificClassParameter
("waf.security_helper_class", Parameter.REQUIRED,
com.arsdigita.kernel.security.DefaultSecurityHelper.class,
com.arsdigita.kernel.security.SecurityHelper.class);
/** This parameter is obsolete. */
private final Parameter m_sessionTrackingMethod = new StringParameter
("waf.session_tracking_method", Parameter.REQUIRED, "cookie");
// /** This parameter is obsolete. */
// private final Parameter m_sessionTrackingMethod = new StringParameter
// ("waf.session_tracking_method", Parameter.REQUIRED, "cookie");
/** List of extensions excluded from authentication cookies.
* Authentication is checked for all requests, but requests with one of
* these extensions will never cause a new cookie to be set.
@ -69,38 +72,50 @@ public class SecurityConfig extends AbstractConfig {
private final Parameter m_excludedExtensions = new StringArrayParameter
("waf.excluded_extensions", Parameter.REQUIRED,
new String[] { ".jpg", ".gif", ".png", ".pdf" } );
/** Key for the root page of the site. */
private final Parameter m_rootPage = new StringParameter
("waf.pagemap.root", Parameter.REQUIRED, "register/");
/** Key for the login page. */
private final Parameter m_loginPage = new StringParameter
("waf.pagemap.login", Parameter.REQUIRED, "register/");
/** Key for the new user page. */
private final Parameter m_newUserPage = new StringParameter
("waf.pagemap.newuser", Parameter.REQUIRED, "register/new-user");
/** Key for the logout page. */
private final Parameter m_logoutPage = new StringParameter
("waf.pagemap.logout", Parameter.REQUIRED, "register/logout");
/** Key for the explain-cookies page. */
private final Parameter m_cookiesPage = new StringParameter
("waf.pagemap.cookies", Parameter.REQUIRED, "register/explain-persistent-cookies");
/** Key for the change-password page. **/
private final Parameter m_changePage = new StringParameter
("waf.pagemap.change", Parameter.REQUIRED, "register/change-password");
/** Key for the recover-password page. **/
private final Parameter m_recoverPage = new StringParameter
("waf.pagemap.recover", Parameter.REQUIRED, "register/recover-password");
/** Key for the login-expired page. */
private final Parameter m_expiredPage = new StringParameter
("waf.pagemap.expired", Parameter.REQUIRED, "register/login-expired");
private final Parameter m_workspacePage = new StringParameter
("waf.pagemap.workspace", Parameter.REQUIRED, "pvt/");
private final Parameter m_loginRedirectPage = new StringParameter
("waf.pagemap.login_redirect", Parameter.REQUIRED, "pvt/");
private final Parameter m_permissionPage = new StringParameter
("waf.pagemap.permission", Parameter.REQUIRED, "permissions/");
private final Parameter m_permSinglePage = new StringParameter
("waf.pagemap.perm_single", Parameter.REQUIRED, "permissions/one");
// /////////////////////////////////////////////////////////////////////////////
// This section completely moved to com.arsdigita.ui.UIConfig.
// Configuration is not an Initializer task.
// Retained here during transition, should be removed when completed (2011-02)
// /////////////////////////////////////////////////////////////////////////////
// /** Key for the root page of the site. */
// private final Parameter m_rootPage = new StringParameter
// ("waf.pagemap.root", Parameter.REQUIRED, "register/");
// /** Key for the login page. */
// private final Parameter m_loginPage = new StringParameter
// ("waf.pagemap.login", Parameter.REQUIRED, "register/");
// /** Key for the new user page. */
// private final Parameter m_newUserPage = new StringParameter
// ("waf.pagemap.newuser", Parameter.REQUIRED, "register/new-user");
// /** Key for the logout page. */
// private final Parameter m_logoutPage = new StringParameter
// ("waf.pagemap.logout", Parameter.REQUIRED, "register/logout");
// /** Key for the explain-cookies page. */
// private final Parameter m_cookiesPage = new StringParameter
// ("waf.pagemap.cookies", Parameter.REQUIRED,
// "register/explain-persistent-cookies");
// /** Key for the change-password page. **/
// private final Parameter m_changePage = new StringParameter
// ("waf.pagemap.change", Parameter.REQUIRED, "register/change-password");
// /** Key for the recover-password page. **/
// private final Parameter m_recoverPage = new StringParameter
// ("waf.pagemap.recover", Parameter.REQUIRED, "register/recover-password");
// /** Key for the login-expired page. */
// private final Parameter m_expiredPage = new StringParameter
// ("waf.pagemap.expired", Parameter.REQUIRED, "register/login-expired");
// private final Parameter m_workspacePage = new StringParameter
// ("waf.pagemap.workspace", Parameter.REQUIRED, "pvt/");
// private final Parameter m_loginRedirectPage = new StringParameter
// ("waf.pagemap.login_redirect", Parameter.REQUIRED, "pvt/");
// private final Parameter m_permissionPage = new StringParameter
// ("waf.pagemap.permission", Parameter.REQUIRED, "permissions/");
// private final Parameter m_permSinglePage = new StringParameter
// ("waf.pagemap.perm_single", Parameter.REQUIRED, "permissions/one");
// ////////////////////////////////////////////////////////////////////////////
private final Parameter m_cookieDurationMinutes = new IntegerParameter
("waf.pagemap.cookies_duration_minutes", Parameter.OPTIONAL, null);
private final Parameter m_cookieDomain = new StringParameter
@ -131,24 +146,25 @@ public class SecurityConfig extends AbstractConfig {
*/
public SecurityConfig() {
register(m_securityHelperClass);
register(m_sessionTrackingMethod);
// register(m_sessionTrackingMethod);
register(m_excludedExtensions);
register(m_rootPage);
register(m_loginPage);
register(m_newUserPage);
register(m_logoutPage);
register(m_cookiesPage);
register(m_changePage);
register(m_recoverPage);
register(m_expiredPage);
register(m_workspacePage);
register(m_loginRedirectPage);
register(m_permissionPage);
register(m_permSinglePage);
// MOVED, see above
// register(m_rootPage);
// register(m_loginPage);
// register(m_newUserPage);
// register(m_logoutPage);
// register(m_cookiesPage);
// register(m_changePage);
// register(m_recoverPage);
// register(m_expiredPage);
// register(m_workspacePage);
// register(m_loginRedirectPage);
// register(m_permissionPage);
// register(m_permSinglePage);
register(m_cookieDomain);
register(m_loginConfig);
register(m_cookieDurationMinutes);
register(m_adminEmail);
register(m_autoRegistrationOn);
@ -184,13 +200,13 @@ public class SecurityConfig extends AbstractConfig {
return (Class) get(m_securityHelperClass);
}
/**
* Obsolete!
* @return
*/
public final String getSessionTrackingMethod() {
return (String) get(m_sessionTrackingMethod);
}
// /**
// * Obsolete!
// * @return
// */
// public final String getSessionTrackingMethod() {
// return (String) get(m_sessionTrackingMethod);
// }
/**
*
@ -200,42 +216,45 @@ public class SecurityConfig extends AbstractConfig {
return Arrays.asList( (String[]) get(m_excludedExtensions));
}
String getRootPage() {
return (String) get(m_rootPage);
}
String getLoginPage() {
return (String) get(m_loginPage);
}
String getNewUserPage() {
return (String) get(m_newUserPage);
}
String getLogoutPage() {
return (String) get(m_logoutPage);
}
String getCookiesPage() {
return (String) get(m_cookiesPage);
}
String getChangePage() {
return (String) get(m_changePage);
}
String getRecoverPage() {
return (String) get(m_recoverPage);
}
String getExpiredPage() {
return (String) get(m_expiredPage);
}
String getWorkspacePage() {
return (String) get(m_workspacePage);
}
public String getLoginRedirectPage() {
return (String) get(m_loginRedirectPage);
}
String getPermissionPage() {
return (String) get(m_permissionPage);
}
String getPermSinglePage() {
return (String) get(m_permSinglePage);
}
// MOVED, see above
// String getRootPage() {
// return (String) get(m_rootPage);
// }
// String getLoginPage() {
// return (String) get(m_loginPage);
// }
// String getNewUserPage() {
// return (String) get(m_newUserPage);
// }
// String getLogoutPage() {
// return (String) get(m_logoutPage);
// }
// String getCookiesPage() {
// return (String) get(m_cookiesPage);
// }
// String getChangePage() {
// return (String) get(m_changePage);
// }
// String getRecoverPage() {
// return (String) get(m_recoverPage);
// }
// String getExpiredPage() {
// return (String) get(m_expiredPage);
// }
// String getWorkspacePage() {
// return (String) get(m_workspacePage);
// }
// public String getLoginRedirectPage() {
// return (String) get(m_loginRedirectPage);
// }
// String getPermissionPage() {
// return (String) get(m_permissionPage);
// }
// String getPermSinglePage() {
// return (String) get(m_permSinglePage);
// }
// ///////////////////////////////////////////////////////////////////////////
public String getCookieDomain() {
return (String) get(m_cookieDomain);
}
@ -259,7 +278,8 @@ public class SecurityConfig extends AbstractConfig {
private static synchronized String getSystemAdministratorEmailAddress() {
if (s_systemAdministratorEmailAddress == null) {
ObjectPermissionCollection perms = PermissionService.getGrantedUniversalPermissions();
ObjectPermissionCollection perms =
PermissionService.getGrantedUniversalPermissions();
perms.addEqualsFilter("granteeIsUser", Boolean.TRUE);
perms.clearOrder();
perms.addOrder("granteeID");

View File

@ -1,51 +1,3 @@
waf.pagemap.root.title=Root Page
waf.pagemap.root.purpose=Enter the relative URL for top-level page
waf.pagemap.root.example=register/
waf.pagemap.root.format=[string]
waf.pagemap.login.title=Login Page
waf.pagemap.login.purpose=Enter the relative URL for the Login page
waf.pagemap.login.example=register/
waf.pagemap.login.format=[string]
waf.pagemap.newuser.title=New User Page
waf.pagemap.newuser.purpose=Enter the relative URL for the New User Page
waf.pagemap.newuser.example=register/new-user
waf.pagemap.newuser.format=[string]
waf.pagemap.logout.title=Logout Page
waf.pagemap.logout.purpose=Enter the relative URL for the Logout Page
waf.pagemap.logout.example=register/logout
waf.pagemap.logout.format=[string]
waf.pagemap.cookies.title=Cookies Explanation Page
waf.pagemap.cookies.purpose=Enter the relative URL for the Cookies explanation page
waf.pagemap.cookies.example=register/explain-persistent-cookies
waf.pagemap.cookies.format=[string]
waf.pagemap.change.title=Change Password Page
waf.pagemap.change.purpose=Enter the relative URL for the Change Password Page
waf.pagemap.change.example=register/change-password
waf.pagemap.change.format=[string]
waf.pagemap.recover.title=Recover Password Page
waf.pagemap.recover.purpose=Enter the relative URL for the Recover Password Page
waf.pagemap.recover.example=register/recover-password
waf.pagemap.recover.format=[string]
waf.pagemap.expired.title=Expired Login Page
waf.pagemap.expired.purpose=Enter the relative URL for the expired login message
waf.pagemap.expired.example=register/login-expired
waf.pagemap.expired.format=[string]
waf.pagemap.workspace.title=Workspace Page
waf.pagemap.workspace.purpose=Enter the relative URL for the Workspace Page
waf.pagemap.workspace.example=pvt/
waf.pagemap.workspace.format=[string]
waf.pagemap.login_redirect.title=Login Redirect Page
waf.pagemap.login_redirect.purpose=Enter the relative URL for redirect upon login
waf.pagemap.login_redirect.example=pvt/
waf.pagemap.login_redirect.format=[string]
waf.pagemap.permission.title=Permissions Page
waf.pagemap.permission.purpose=Enter the relative URL for the main Permissions administration page
waf.pagemap.permission.example=permissions/
waf.pagemap.permission.format=[string]
waf.pagemap.perm_single.title=Single object Permissions Page
waf.pagemap.perm_single.purpose=Enter the relative URL for the Single Object permissons administration page
waf.pagemap.perm_single.example=permissions/one
waf.pagemap.perm_single.format=[string]
waf.login_config.title=Login Configuration
waf.login_config.purpose=Enter JAAS login configuration, using the syntax described in Javadoc for com.arsdigita.kernel.security.LoginConfig
waf.login_config.example=Request:com.arsdigita.kernel.security.AdminLoginModule:sufficient,Register:com.arsdigita.kernel.security.LocalLoginModule:requisite
@ -66,3 +18,54 @@ waf.user_ban_on.title=User Ban
waf.user_ban_on.purpose=Check on each access if user has been banned from the site.
waf.user_ban_on.example=false
waf.user_ban_on.format=true|false
# Moved to com.arsdigita.ui.UIConfig (2011-02).
# Retained here for easy reference during transition phase
# waf.pagemap.root.title=Root Page
# waf.pagemap.root.purpose=Enter the relative URL for top-level page
# waf.pagemap.root.example=register/
# waf.pagemap.root.format=[string]
# waf.pagemap.login.title=Login Page
# waf.pagemap.login.purpose=Enter the relative URL for the Login page
# waf.pagemap.login.example=register/
# waf.pagemap.login.format=[string]
# waf.pagemap.newuser.title=New User Page
# waf.pagemap.newuser.purpose=Enter the relative URL for the New User Page
# waf.pagemap.newuser.example=register/new-user
# waf.pagemap.newuser.format=[string]
# waf.pagemap.logout.title=Logout Page
# waf.pagemap.logout.purpose=Enter the relative URL for the Logout Page
# waf.pagemap.logout.example=register/logout
# waf.pagemap.logout.format=[string]
# waf.pagemap.cookies.title=Cookies Explanation Page
# waf.pagemap.cookies.purpose=Enter the relative URL for the Cookies explanation page
# waf.pagemap.cookies.example=register/explain-persistent-cookies
# waf.pagemap.cookies.format=[string]
# waf.pagemap.change.title=Change Password Page
# waf.pagemap.change.purpose=Enter the relative URL for the Change Password Page
# waf.pagemap.change.example=register/change-password
# waf.pagemap.change.format=[string]
# waf.pagemap.recover.title=Recover Password Page
# waf.pagemap.recover.purpose=Enter the relative URL for the Recover Password Page
# waf.pagemap.recover.example=register/recover-password
# waf.pagemap.recover.format=[string]
# waf.pagemap.expired.title=Expired Login Page
# waf.pagemap.expired.purpose=Enter the relative URL for the expired login message
# waf.pagemap.expired.example=register/login-expired
# waf.pagemap.expired.format=[string]
# waf.pagemap.workspace.title=Workspace Page
# waf.pagemap.workspace.purpose=Enter the relative URL for the Workspace Page
# waf.pagemap.workspace.example=pvt/
# waf.pagemap.workspace.format=[string]
# waf.pagemap.login_redirect.title=Login Redirect Page
# waf.pagemap.login_redirect.purpose=Enter the relative URL for redirect upon login
# waf.pagemap.login_redirect.example=pvt/
# waf.pagemap.login_redirect.format=[string]
# waf.pagemap.permission.title=Permissions Page
# waf.pagemap.permission.purpose=Enter the relative URL for the main Permissions administration page
# waf.pagemap.permission.example=permissions/
# waf.pagemap.permission.format=[string]
# waf.pagemap.perm_single.title=Single object Permissions Page
# waf.pagemap.perm_single.purpose=Enter the relative URL for the Single Object permissons administration page
# waf.pagemap.perm_single.example=permissions/one
# waf.pagemap.perm_single.format=[string]

View File

@ -54,7 +54,7 @@ final class Store implements KeyStorage {
Store() {}
static byte[] newKey() {
byte[] key = new byte[LegacyInitializer.SECRET_KEY_BYTES];
byte[] key = new byte[SecurityConfig.SECRET_KEY_BYTES];
new SecureRandom().nextBytes(key);
return key;
}
@ -107,9 +107,9 @@ final class Store implements KeyStorage {
throw new IllegalStateException
("the store is null");
}
if ( m_secret.length != LegacyInitializer.SECRET_KEY_BYTES ) {
if ( m_secret.length != SecurityConfig.SECRET_KEY_BYTES ) {
throw new IllegalArgumentException
("wrong length. expected=" + LegacyInitializer.SECRET_KEY_BYTES +
("wrong length. expected=" + SecurityConfig.SECRET_KEY_BYTES +
", but got " + m_secret.length);
}
return m_secret;

View File

@ -57,6 +57,8 @@ import org.apache.log4j.Logger;
*
* <p><b>Subject to change!</b></p>
*
* A similiar task is performed by com.arsdigita.util.ResourceManager
*
* @author Justin Ross &lt;jross@redhat.com&gt;
* rewritten by
* @author pboy &lt;pboy@barkhof.uni-bremen.de&gt;

View File

@ -0,0 +1,458 @@
/*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.ui;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
/**
* <p>A central location for commonly used UI services and their accessories.</p>
*
*
* @author pb
*/
public abstract class UI {
/** Private loggin instance. */
private static final Logger s_log = Logger.getLogger(UI.class);
/** The UI XML namespace. */
public static final String UI_XML_NS = "http://www.arsdigita.com/ui/1.0";
private static final UIConfig s_config = UIConfig.getConfig();
/** (Relative) URL for systems public top level page. */
// In old LegacyInitializer ROOT_PAGE_KEY =pagemap.root= register/ | portal/
private static final String s_rootPageURL = s_config.getRootPage();
/** (Relative) URL for systems login page. */
private static final String s_loginURL = s_config.getLogin();
/** (Relative) URL for systems logout page. */
private static final String s_logoutURL = s_config.getLogout();
/**
* */
private static final String s_userRedirectURL = s_config.getUserRedirect();
/** (Relative) URL for workspace page. */
private static final String s_workspaceURL = s_config.getWorkspace();
/** Root URL */
// This address used to be determinded by
// SiteNode.getRootSiteNode().getURL();
// It provides a sitenode without a name an without any parent, i.e. "/"
// There is no information whether the context path (in case we are not
// installed as root application (context) of the servlet(!) container).
// It does obviously NOT include the constant prefix, generated by the
// new dispatcher.
//
// Previously an variant had been used:
// SiteNode.getRootSiteNode().getURL(request);
// but according to a developers comment the latter is not save:
// "this isn't safe since you aren't neccessarily calling it from
// the root webapp - so we can't blindly prepend the context path
// from the current request."
//
// Sitenode is deprecated, web.Application should be used instead. But here
// there is no application to invoke, but we need the root part of the URL
// for a page to be prepended to its address. This depends on the
// installation, not on the request or the specific application.
//
// XXX must be generated from an installation config record.
private static final String s_rootURL = "/";
/**
* Provides a handle to the UI config record.
*
* @return Instance of UIConfig
*/
public static UIConfig getConfig() {
return s_config;
}
/**
* Provides an absolute URL (leading slash) into the system top-level page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* Therefore the request parameter is not ignored! This variant is retained
* for backwards compatibility only.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return URL for top-level page as String
*/
// In old LegacyInitializer ROOT_PAGE_KEY = pagemap.root = register/
// (usually modif. to portal/nav)
public static String getRootPageURL(HttpServletRequest req) {
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + s_rootURL + ", url is " + s_rootPageURL);
}
if ((s_rootURL == null) || (s_rootPageURL == null)) {
return null;
}
return s_rootURL + s_rootPageURL;
}
/**
* Provides an absolute URL (leading slash) into the system top-level page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return URL for top-level page as String
*/
// In old LegacyInitializer ROOT_PAGE_KEY = register/ (modif. to portal/nav)
public static String getRootPageURL() {
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + s_rootURL + ", url is " + s_rootPageURL);
}
if ((s_rootURL == null) || (s_rootPageURL == null)) {
return null;
}
return s_rootURL + s_rootPageURL;
// return s_rootPageURL;
}
/**
* Provides an absolute URL (leading slash) into the system login page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return URL for login page as String
*/
// In old LegacyInitializer
// LOGIN_PAGE_KEY = page.kernel.login = register/
public static String getLoginPageURL() {
return s_rootURL + s_loginURL;
}
/**
* Provides an absolute URL (leading slash) for a login expired info page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return url String for new user registration page as String
*/
// In old LegacyInitializer
// EXPIRED_PAGE_KEY =page.kernel.expired=register/login-expired/
public static String getLoginExpiredPageURL() {
return s_rootURL + s_loginURL + "login-expired/";
}
/**
* Provides an absolute URL (leading slash) for a cookie explanation page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return url String for new user registration page as String
*/
// In old LegacyInitializer
//COOKIES_PAGE_KEY =page.kernel.cookies=register/explain-persistent-cookies/
public static String getCookiesExplainPageURL() {
return s_rootURL + s_loginURL + "explain-persistent-cookies/";
}
/**
* Provides an absolute URL (leading slash) for a password recovery page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return url String for new user registration page as String
*/
// In old LegacyInitializer
// RECOVER_PAGE_KEY =page.kernel.recover = register/recover-password/
public static String getRecoverPasswordPageURL() {
return s_rootURL + s_loginURL + "recover-password/";
}
/**
* Provides an absolute URL (leading slash) to a user profile editig page.
* It is relative to document root without any constant prefix if there is
* one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return url String for new user registration page as String
*/
// In old LegacyInitializer
// EDIT_PAGE_KEY = page.kernel.edit = register/edit-profile/
public static String getEditUserProfilePageURL() {
return s_rootURL + s_loginURL + "edit-profile/";
}
/**
* Provides an absolute URL (leading slash) for an edit (change) password
* page. It is relative to document root without any constant prefix if
* there is one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher. The
* leading slash it API change! It's impacts have to be checked. (2011-02)
*
* @return url String for new user registration page as String
*/
// In old LegacyInitializer
// CHANGE_PAGE_KEY = page.kernel.change = register/change-password/
public static String getChangePasswordPageURL() {
return s_rootURL + s_loginURL + "change-password/";
}
/**
* Provides an absolute URL (leading slash) to an optional new user
* registration page (accessible only if activated). It is relative to
* document root without any constant prefix if there is one configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return url String for new user registration page as String
*/
// In old LegacyInitializer
// NEWUSER_PAGE_KEY = page.kernel.newuser = register/new-user/
public static String getNewUserPageURL() {
return s_rootURL + s_loginURL + "new-user/";
}
/**
* Provides an absolute URL (leading slash) for the system logout page. It
* is relative to document root without any constant prefix if there is one
* configured.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return URL for logout page as String
*/
// In old LegacyInitializer
// LOGOUT_PAGE_KEY =page.kernel.logout=register/logout/
public static String getLogoutPageURL() {
return s_rootURL + s_logoutURL;
}
/**
* Provides the absolute URL of a page, which redirects an incomming request
* based on some clients property, usually whether the user is logged in,
* either to a general public page or to a user (client) specific page.
*
* It is relative to document root including leading slash but without any
* constant prefix if there is one configured.
*
* It is used by the ccm index page (home/start page) ~/index.jsp. By default
* it is configured as "pvt/" which redirects to a user specific home page
* if the initial incomming request comes from a logged in user.
* Applications may configure a different page according to their specific
* purposes. e.g ccm-cms provides a page content/content-center-redirect.jsp
* which redirects a user to the content-center if logged in.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* Previous implementation of this method signature (no parameter) returned
* an url without leading slash.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return full URL of a user redirect page, may be null
*/
// In old LegacyInitializer
// LOGIN_REDIRECT_PAGE_KEY =page.kernel.login.redirect=pvt/
// (usually modified to "content/content-center-redirect-page.jsp")
public static String getUserRedirectURL() {
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + s_rootURL + ", url is " + s_userRedirectURL);
}
if ((s_rootURL == null) || (s_userRedirectURL == null)) {
return null;
}
return s_rootURL + s_userRedirectURL;
}
/**
* Provides the absolute URL of a page, which redirects an incomming request
* based on some clients property, usually whether the user is logged in,
* either to a general public page or to a user (client) specific page.
*
* It is relative to document root including leading slash but without any
* constant prefix if there is one configured.
*
* It is used by the ccm index page (home/start page) ~/index.jsp. By default
* it is configured as "pvt/" which redirects to a user specific home page
* if the initial incomming request comes from a logged in user.
* Applications may configure a different page according to their specific
* purposes. e.g ccm-cms provides a page content/content-center-redirect.jsp
* which redirects a user to the content-center if logged in.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* Previous implementation of this method signature (HTTPServletRequest)
* returned an url to a registration redirect page either starting with a
* slash for root context or the context path part. HTTPServletRequest is
* no longer significant here and method signature retained here for
* backwards compatibility only.
*
* @param req HttpServletRequest, may be used to determin the context of
* the current thread (application), currently not used and
* introduced here for backwards compatibility
* @return full URL of a user redirect page, may be null
*/
// see comment at top about getRootURL(req) for details!
// In old LegacyInitializer
// LOGIN_REDIRECT_PAGE_KEY =page.kernel.login.redirect=pvt/
// (usually modified to "content/content-center-redirect-page.jsp")
public static String getUserRedirectURL(HttpServletRequest req) {
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + s_rootURL + ", url is " + s_userRedirectURL);
}
if ((s_rootURL == null) || (s_userRedirectURL == null)) {
return null;
}
return s_rootURL + s_userRedirectURL;
}
/**
* Provides the absolute URL for the system workspace page. It is relative
* to document root including leading slash but without any constant prefix
* if there is one configured.
*
* It is used by the user redirection page (see above) as redirection target
* if no logged in user exists or no user specific page is configured. By
* default it is configured as "pvt/" as well. An installation usually
* defines a different page according to their specific purposes, e.g.
* portal or navigation.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* Previous implementation of this method signature (no parameter) returned
* an url without leading slash.
* The leading slash it API change! It's impacts have tp be checked. (2011-02)
*
* @return URL for workspace page as String
*/
// In old LegacyInitializer
// WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav)
public static String getWorkspaceURL() {
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + s_rootURL + ", url is " + s_workspaceURL);
}
if ((s_rootURL == null) || (s_workspaceURL == null)) {
return null;
}
return s_rootURL + s_workspaceURL;
}
/**
* Provides the absolute URL for the system workspace page.
* It is relative to document root including leading slash but without any
* constant prefix if there is one configured.
*
* It is used by the user redirection page (see above) as redirection target
* if no logged in user exists or no user specific page is configured. By
* default it is configured as "pvt/" as well. An installation usually
* defines a different page according to their specific purposes, e.g.
* portal or navigation.
*
* XXX This implementation starts with a leading slash and ends with a slash.
* In previous configurations String urls began without a slash in order
* to be able to provide a full URL which also contains the context part.
* Since version 5.2 the context part is handled by (new) dispatcher.
* Previous implementation of this method signature (HTTPServletRequest)
* returned an url to a workspace page either starting with a
* slash for root context or the context path part. HTTPServletRequest is
* no longer significant here and method signature retained here for
* backwards compatibility only.
*
*
* @param req HttpServletRequest, may be used to determin the context of
* the current thread (application), currently not used and
* introduced here for backwards compatibility
* @return URL for workspace page as String
*/
// In old LegacyInitializer
// WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav)
public static String getWorkspaceURL(HttpServletRequest req) {
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + s_rootURL + ", url is " + s_workspaceURL);
}
if ((s_rootURL == null) || (s_workspaceURL == null)) {
return null;
}
return s_rootURL + s_workspaceURL;
}
// In old LegacyInitializer
// PERMISSION_PAGE_KEY = page.kernel.permission = permissions/
// In old LegacyInitializer
// PERM_SINGLE_PAGE_KEY = page.kernel.perm-single = permissions/one/
}

View File

@ -21,6 +21,7 @@ package com.arsdigita.ui;
import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.StringUtils;
import com.arsdigita.util.parameter.StringParameter;
import com.arsdigita.util.parameter.StringArrayParameter;
import com.arsdigita.util.parameter.Parameter;
@ -32,7 +33,10 @@ import org.apache.log4j.Logger;
/**
* A configuration record for configuration of the core UI package
* (layoput of main UI components).
* (layout of main UI components).
*
* Accessors of this class may return null. Developers should take care
* to trap null return values in their code.
*
* @author Peter Boy &lt;pboy@barkhof.uni-bremen.de&gt;
* @version $Id: $
@ -52,7 +56,7 @@ public class UIConfig extends AbstractConfig {
* constructor directly!
* @return
*/
public static final synchronized UIConfig getConfig() {
public static synchronized UIConfig getConfig() {
if (s_conf == null) {
s_conf = new UIConfig();
s_conf.load();
@ -89,7 +93,7 @@ public class UIConfig extends AbstractConfig {
// Quick 'md Dirty, we reeally need a StringListParameter class
private final Parameter m_defaultLayout =
new StringArrayParameter(
"waf.ui.default_layout",
"core.ui.default_layout",
Parameter.REQUIRED,
new String[]
{ "top:com.arsdigita.ui.UserBanner"
@ -128,11 +132,46 @@ public class UIConfig extends AbstractConfig {
*/
private final Parameter m_applicationLayouts =
new StringArrayParameter(
"waf.ui.application_layouts",
"core.ui.application_layouts",
Parameter.OPTIONAL,
null
);
/** String containing the relative URL for the top level page
* (or entry page / home page) of the site, Without leading slash but with
* trailing slash in case of a directory.
* By default it is the login page, but usually the root page of the main
* presentation application, e.g. portal, navigation, forum, etc. */
// Old initializer: waf.pagemap.root
private final Parameter m_rootPageURL = new StringParameter
("core.ui.pagemap.root_page_url", Parameter.REQUIRED, "register/");
/**String containing the URL for the login page, Without leading slash but
* with trailing slash in case of a directory. */
// Old initializer: waf.pagemap.login
private final Parameter m_loginURL = new StringParameter
("core.ui.pagemap.login_url", Parameter.REQUIRED, "register/");
/** String containing the URL for the logout page, Without leading slash
* but with trailing slash in case of a directory. */
// Old initializer: waf.pagemap.logout
private final Parameter m_logoutURL = new StringParameter
("core.ui.pagemap.logout_url", Parameter.REQUIRED, "register/logout");
/** String containing the URL for a page which may perform a user specific
* redirect if logged in or to a general public page if not. */
// Used to be LOGIN_REDIRECT_PAGE_KEY in old kernel/security/initializer
// parameter waf.pagemap.login_redirect = pvt/
// XXX url pvt seems not to exist anymore! (pboy 2011-02-03)
private final Parameter m_userRedirectURL = new StringParameter
("core.ui.pagemap.user_redirect_url", Parameter.REQUIRED, "pvt/");
/** String containing the URL for the workspace of the site. */
// Old initializer: waf.pagemap.workspace
// XXX url pvt seems not to exist anymore! (pboy 2011-02-03)
private final Parameter m_workspaceURL = new StringParameter
("core.ui.pagemap.workspace_url", Parameter.REQUIRED, "pvt/");
/**
* Constructs an empty RuntimeConfig object.
*
@ -145,6 +184,12 @@ public class UIConfig extends AbstractConfig {
register(m_defaultLayout);
register(m_applicationLayouts);
register(m_rootPageURL);
register(m_loginURL);
register(m_logoutURL);
register(m_userRedirectURL);
register(m_workspaceURL);
loadInfo();
}
@ -195,4 +240,49 @@ public class UIConfig extends AbstractConfig {
}
}
/**
* Retrieve systems root page (entry page) url.
*
* @return root page url
*/
public String getRootPage() {
return (String)get(m_rootPageURL) ;
}
/**
* Retrieve systems login page url.
*
* @return login page url
*/
public String getLogin() {
return (String)get(m_loginURL) ;
}
/**
* Retrieve systems logout page url.
*
* @return logout page url
*/
public String getLogout() {
return (String)get(m_logoutURL) ;
}
/**
* Retrieve systems user login redirect page url.
*
* @return user login redirect page url
*/
public String getUserRedirect() {
return (String)get(m_userRedirectURL) ;
}
/**
* Retrieve systems workspace url.
*
* @return workspace page url
*/
public String getWorkspace() {
return (String)get(m_workspaceURL) ;
}
}

View File

@ -1,9 +1,70 @@
waf.ui.default_layout.title=Default Layout
waf.ui.default_layout.purpose=Default layout components for SimplePage class
waf.ui.default_layout.example="top,com.arsdigita.ui.UserBanner","bottom,com.arsdigita.ui.SiteBanner","left,com.arsdigita.x.y.zl",
waf.ui.default_layout.format=[StringArray]
core.ui.default_layout.title=Default Layout
core.ui.default_layout.purpose=Default layout components for SimplePage class
core.ui.default_layout.example="top,com.arsdigita.ui.UserBanner","bottom,com.arsdigita.ui.SiteBanner","left,com.arsdigita.x.y.zl",
core.ui.default_layout.format=[StringArray]
waf.ui.application_layouts.title=Application Layouts
waf.ui.application_layouts.purpose=The customized layout for applications using the SimplePage class
waf.ui.application_layouts.example=unkown
waf.ui.application_layouts.format=[StringArray]
core.ui.application_layouts.title=Application Layouts
core.ui.application_layouts.purpose=The customized layout for applications using the SimplePage class
core.ui.application_layouts.example=unkown
core.ui.application_layouts.format=[StringArray]
core.ui.pagemap.root_page_url.title=Root Page
core.ui.pagemap.root_page_url.purpose=Enter the relative URL for top-level page (to document root and without constant prefix if configured)
core.ui.pagemap.root_page_url.example=register/
core.ui.pagemap.root_page_url.format=[string]
core.ui.pagemap.login_url.title=Login Page
core.ui.pagemap.login_url.purpose=Enter the relative URL for the Login page (to document root and without constant prefix if configured)
core.ui.pagemap.login_url.example=register/
core.ui.pagemap.login_url.format=[string]
core.ui.pagemap.logout_url.title=Logout Page
core.ui.pagemap.logout_url.purpose=Enter the relative URL for the Logout Page (to document root and without constant prefix if configured)
core.ui.pagemap.logout_url.example=register/logout
core.ui.pagemap.logout_url.format=[string]
core.ui.pagemap.user_redirect_url.title=User Redirect Page
core.ui.pagemap.user_redirect_url.purpose=Enter the relative URL to a page which redirects the request according to the logged in user (if exists)
core.ui.pagemap.user_redirect_url.example=pvt/
core.ui.pagemap.user_redirect_url.format=[string]
core.ui.pagemap.workspace_url.title=Workspace Page
core.ui.pagemap.workspace_url.purpose=Enter the relative URL for the Workspace Page (to document root and without constant prefix if configured)
core.ui.pagemap.workspace_url.example=pvt/
core.ui.pagemap.workspace_url.format=[string]
#waf.pagemap.newuser.title=New User Page
#waf.pagemap.newuser.purpose=Enter the relative URL for the New User Page
#waf.pagemap.newuser.example=register/new-user
#waf.pagemap.newuser.format=[string]
#waf.pagemap.cookies.title=Cookies Explanation Page
#waf.pagemap.cookies.purpose=Enter the relative URL for the Cookies explanation page
#waf.pagemap.cookies.example=register/explain-persistent-cookies
#waf.pagemap.cookies.format=[string]
#waf.pagemap.change.title=Change Password Page
#waf.pagemap.change.purpose=Enter the relative URL for the Change Password Page
#waf.pagemap.change.example=register/change-password
#waf.pagemap.change.format=[string]
#waf.pagemap.recover.title=Recover Password Page
#waf.pagemap.recover.purpose=Enter the relative URL for the Recover Password Page
#waf.pagemap.recover.example=register/recover-password
#waf.pagemap.recover.format=[string]
#waf.pagemap.expired.title=Expired Login Page
#waf.pagemap.expired.purpose=Enter the relative URL for the expired login message
#waf.pagemap.expired.example=register/login-expired
#waf.pagemap.expired.format=[string]
#waf.pagemap.permission.title=Permissions Page
#waf.pagemap.permission.purpose=Enter the relative URL for the main Permissions administration page
#waf.pagemap.permission.example=permissions/
#waf.pagemap.permission.format=[string]
#waf.pagemap.perm_single.title=Single object Permissions Page
#waf.pagemap.perm_single.purpose=Enter the relative URL for the Single Object permissons administration page
#waf.pagemap.perm_single.example=permissions/one
#waf.pagemap.perm_single.format=[string]

View File

@ -23,7 +23,6 @@ import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element;
import com.arsdigita.ui.util.GlobalizationUtil;
@ -103,26 +102,27 @@ public class UserBanner extends SimpleComponent {
content.addAttribute(
"workspaceURL",
URL.there(state.getRequest(),
LegacyInitializer.getFullURL(LegacyInitializer.WORKSPACE_PAGE_KEY,
state.getRequest())).toString());
UI.getWorkspaceURL()).toString());
// LegacyInitializer.getFullURL(LegacyInitializer.WORKSPACE_PAGE_KEY,
// state.getRequest())).toString());
content.addAttribute(
"loginURL",
URL.there(state.getRequest(),
LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_PAGE_KEY,
state.getRequest())).toString());
UI.getLoginPageURL()).toString());
// LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_PAGE_KEY,
// state.getRequest())).toString());
content.addAttribute(
"loginExcursionURL",
URL.excursion(state.getRequest(),
LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_PAGE_KEY,
state.getRequest())).toString());
UI.getLoginPageURL()).toString());
// LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_PAGE_KEY,
// state.getRequest())).toString());
content.addAttribute(
"logoutURL",
URL.there(state.getRequest(),
LegacyInitializer.getFullURL(LegacyInitializer.LOGOUT_PAGE_KEY,
state.getRequest())).toString());
URL.there(state.getRequest(),UI.getLoginPageURL()).toString());
}
}

View File

@ -19,7 +19,6 @@
package com.arsdigita.ui.admin;
import com.arsdigita.ui.util.GlobalizationUtil ;
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.BoxPanel;
@ -35,9 +34,9 @@ import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.TabbedPane;
// import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
// import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.ChangeEvent;
import com.arsdigita.bebop.event.ChangeListener;
@ -50,6 +49,7 @@ import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.ui.UI ;
import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
import com.arsdigita.web.RedirectSignal;
@ -59,15 +59,17 @@ import com.arsdigita.kernel.Group;
import com.arsdigita.kernel.GroupCollection;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.UserAuthentication;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.util.UncheckedWrapperException;
import java.math.BigDecimal;
import java.util.ArrayList;
import org.apache.log4j.Logger;
/**
@ -285,8 +287,7 @@ class UserBrowsePane extends SegmentedPanel
}
// Redirect to workspace URL
final String path = LegacyInitializer.getFullURL
(LegacyInitializer.LOGIN_REDIRECT_PAGE_KEY, state.getRequest());
final String path = UI.getUserRedirectURL(state.getRequest());
final URL url = URL.there(state.getRequest(), path);
@ -324,7 +325,8 @@ class UserBrowsePane extends SegmentedPanel
return false;
}
// We show the delete link if the user has never published an item
// This implicitly checks whether the user is banned - if they are deletable they cannot ever have been banned
// This implicitly checks whether the user is banned - if they
// are deletable they cannot ever have been banned
User u = getUser(s);
return (!hasUserPublishedItems(u));
}

View File

@ -39,13 +39,13 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.bebop.parameters.URLParameter;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.ui.UI;
import com.arsdigita.web.Web;
import com.arsdigita.web.URL;
import com.arsdigita.web.ReturnSignal;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.UserAuthentication;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.kernel.security.RecoveryLoginModule;
import com.arsdigita.mail.Mail;
import com.arsdigita.util.UncheckedWrapperException;
@ -297,8 +297,7 @@ public class ChangePasswordForm extends Form
final HttpServletRequest req = state.getRequest();
final String path = LegacyInitializer.getFullURL
(LegacyInitializer.WORKSPACE_PAGE_KEY, req);
final String path = UI.getWorkspaceURL(req);
final URL fallback = URL.there(req, path);

View File

@ -22,31 +22,38 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
/**
* Package-private class that generates the URL for a link dynamically from
* the kernel page map. This class will be removed or changes when the page
* map is replaced by package parameters.
*
* 2011-02-04: API change (pboy)
* The page map is no retrieved from a set of parameters. The target is now a
* String representation of the absolut url (leading slash) relativ to
* document root. The target is now a targetUrl, no longer a targetKey.
*
* @author Sameer Ajmani
**/
* @version $Id: DynamicLink.java 287 2005-02-22 00:29:02Z sskracic $
*/
class DynamicLink extends Link {
public static final String versionId =
"$Id: DynamicLink.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/16 18:10:38 $";
DynamicLink(final String labelKey, final String targetKey) {
DynamicLink(final String labelKey, final String targetUrl) {
super(new Label(LoginHelper.getMessage(labelKey)),
new PrintListener() {
public void prepare(PrintEvent e) {
Link link = (Link) e.getTarget();
String url = LegacyInitializer.getFullURL
(targetKey, e.getPageState().getRequest());
// see {@link com.arsdigita.bebopLink#Link(String,URL)}
// Url is now expected without leading context wich is handled
// by the new dispatcher. Therefore the req. is not needed.
// anymore.
// String url = LegacyInitializer.getFullURL
// (targetKey, e.getPageState().getRequest());
link.setTarget(url);
link.setTarget(targetUrl);
}
});
}

View File

@ -21,7 +21,6 @@ package com.arsdigita.ui.login;
import com.arsdigita.bebop.PageState;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.web.ReturnSignal;
import java.io.IOException;
import org.apache.log4j.Logger;
@ -139,54 +138,4 @@ public class LoginHelper {
+"response already committed");
}
}
// /**
// * Returns the relative URL associated with the given key. This is the
// * value of the URL in the page map for the given key.
// *
// * @return the relative URL associated with the given key, or null if it
// * does not exist.
// *
// * @deprecated To be replaced by package parameters.
// *
// * @see #getFullURL(String, HttpServletRequest)
// **/
// public static String getURL(String key) {
// return (String)s_pageMap.get(key);
// }
/**
* Returns the absolute URL associated with the given key. This is the
* root URL for the system (the mount point) prepended to the result of
* getURL(key).
*
* @return the absolute URL associated with the given key, or null
* if it does not exist.
*
* @see #getURL(String)
**/
public static String getFullURL(String key, HttpServletRequest req) {
String root = getRootURL(req);
String url = com.arsdigita.kernel.security.LegacyInitializer.getURL(key);
if (s_log.isDebugEnabled()) {
s_log.debug("Root is " + root + ", url is " + url);
}
if ((root == null) || (key == null)) {
return null;
}
return root + url;
}
private static String getRootURL(HttpServletRequest req) {
// XXX this isn't safe since you aren't neccessarily
// calling it from the root webapp - so we can't
// blindly prepend the context path from the current
// request.
//return SiteNode.getRootSiteNode().getURL(req);
return SiteNode.getRootSiteNode().getURL();
}
}

View File

@ -46,8 +46,9 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.UserAuthentication;
import com.arsdigita.kernel.security.CredentialEncodingException;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.kernel.security.RecoveryLoginModule;
import com.arsdigita.ui.UI;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
import com.arsdigita.mail.Mail;
@ -351,8 +352,9 @@ public class RecoverPasswordPanel extends SimpleContainer
url = com.arsdigita.web.URL.dynamicHostThere
(req,
LegacyInitializer.getFullURL
(LegacyInitializer.CHANGE_PAGE_KEY, req),
// LegacyInitializer.getFullURL
// (LegacyInitializer.CHANGE_PAGE_KEY, req),
UI.getRecoverPasswordPageURL(),
map);
} catch (CredentialEncodingException e) {
throw new UncheckedWrapperException

View File

@ -28,12 +28,13 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.PageFactory;
import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.dispatcher.Dispatcher;
import com.arsdigita.dispatcher.DispatcherConfig;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext;
// import com.arsdigita.dispatcher.Dispatcher;
// import com.arsdigita.dispatcher.DispatcherConfig;
// import com.arsdigita.dispatcher.DispatcherHelper;
// import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.ui.UI;
import com.arsdigita.web.URL;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.ReturnSignal;
@ -62,67 +63,88 @@ import org.apache.log4j.Logger;
**/
public class SubsiteDispatcher extends BebopMapDispatcher {
public static final String APPLICATION_NAME = "login";
private static final Logger s_log =
Logger.getLogger(SubsiteDispatcher.class.getName());
// define namespace URI
final static String SUBSITE_NS_URI =
"http://www.arsdigita.com/subsite/1.0";
/** Dispatcher map class to store url - page mapping */
public class SubsiteDispatcherMap extends HashMap implements Map {
public SubsiteDispatcherMap() {
super();
// TODO Auto-generated constructor stub
}
}
public static final String APPLICATION_NAME = "login";
private static final Logger s_log =
Logger.getLogger(SubsiteDispatcher.class.getName());
// define namespace URI
final static String SUBSITE_NS_URI =
"http://www.arsdigita.com/subsite/1.0";
/**
* Initializes dispatcher by registering URLs with bebop pages.
**/
* Constructor initializes dispatcher by registering URLs with bebop pages.
*/
public SubsiteDispatcher() {
s_log.debug("SubsiteDispatcher is used!!");
//Map map = new HashMap();
s_log.debug("SubsiteDispatcher Constructor entered.");
Map map = new SubsiteDispatcherMap();
// special-case the empty URL
String redirect = LegacyInitializer.getURL(LegacyInitializer.ROOT_PAGE_KEY);
// String redirect = LegacyInitializer.getURL(LegacyInitializer.ROOT_PAGE_KEY);
String redirect = UI.getRootPageURL();
Dispatcher root = new RedirectDispatcher(redirect);
map.put("", root);
map.put("index", root);
put(map, LegacyInitializer.EDIT_PAGE_KEY, buildSimplePage
("login.userEditPage.title", new UserEditForm(), "edit"));
put(map, LegacyInitializer.LOGIN_PAGE_KEY, buildSimplePage
("login.userRegistrationForm.title",
new UserRegistrationForm(Kernel.getSecurityConfig().isAutoRegistrationOn()),
"login"));
// put(map, LegacyInitializer.EDIT_PAGE_KEY, buildSimplePage
put(map, UI.getEditUserProfilePageURL(), buildSimplePage
("login.userEditPage.title",
new UserEditForm(), "edit"));
// put(map, LegacyInitializer.LOGIN_PAGE_KEY, buildSimplePage
put(map, UI.getLoginPageURL(), buildSimplePage
("login.userRegistrationForm.title",
new UserRegistrationForm(
Kernel.getSecurityConfig()
.isAutoRegistrationOn()),
"login"));
if (Kernel.getSecurityConfig().isAutoRegistrationOn()) {
put(map, LegacyInitializer.NEWUSER_PAGE_KEY, buildSimplePage
("login.userNewForm.title", new UserNewForm(),"register"));
// put(map, LegacyInitializer.NEWUSER_PAGE_KEY, buildSimplePage
put(map, UI.getNewUserPageURL(), buildSimplePage
("login.userNewForm.title",
new UserNewForm(),
"register"));
}
put(map, LegacyInitializer.LOGOUT_PAGE_KEY, buildLogOutPage());
put(map, LegacyInitializer.COOKIES_PAGE_KEY, buildSimplePage
// put(map, LegacyInitializer.LOGOUT_PAGE_KEY, buildLogOutPage());
put(map, UI.getLogoutPageURL(), buildLogOutPage());
// put(map, LegacyInitializer.COOKIES_PAGE_KEY, buildSimplePage
put(map, UI.getCookiesExplainPageURL(), buildSimplePage
("login.explainCookiesPage.title", new ElementComponent
("subsite:explainPersistentCookies", SUBSITE_NS_URI), "cookies"));
put(map, LegacyInitializer.CHANGE_PAGE_KEY, buildSimplePage
("login.changePasswordPage.title", new ChangePasswordForm(),
"changepassword"));
put(map, LegacyInitializer.RECOVER_PAGE_KEY, buildSimplePage
("login.recoverPasswordPage.title", new RecoverPasswordPanel(),
"recoverpassword"));
// put(map, LegacyInitializer.CHANGE_PAGE_KEY, buildSimplePage
put(map, UI.getChangePasswordPageURL(), buildSimplePage
("login.changePasswordPage.title",
new ChangePasswordForm(),
"changepassword"));
// put(map, LegacyInitializer.RECOVER_PAGE_KEY, buildSimplePage
put(map, UI.getRecoverPasswordPageURL(), buildSimplePage
("login.recoverPasswordPage.title",
new RecoverPasswordPanel(),
"recoverpassword"));
Page workspace = checkForPageSubClass();
if (workspace == null) workspace = buildSimplePage
("login.workspacePage.title", new UserInfo(), "workspace");
put(map, LegacyInitializer.WORKSPACE_PAGE_KEY, workspace);
put(map, LegacyInitializer.EXPIRED_PAGE_KEY, buildExpiredPage());
("login.workspacePage.title",
new UserInfo(),
"workspace");
// put(map, LegacyInitializer.WORKSPACE_PAGE_KEY, workspace);
put(map, UI.getWorkspaceURL(), workspace);
// put(map, LegacyInitializer.EXPIRED_PAGE_KEY, buildExpiredPage());
put(map, UI.getLoginExpiredPageURL(), buildExpiredPage());
// special case to handle pvt/home
String url = LegacyInitializer.getURL(LegacyInitializer.WORKSPACE_PAGE_KEY);
// String url = LegacyInitializer.getURL(LegacyInitializer.WORKSPACE_PAGE_KEY);
String url = UI.getWorkspaceURL();
if (url.equals("pvt/")) {
map.put("pvt/home", workspace);
}
@ -130,6 +152,28 @@ public class SubsiteDispatcher extends BebopMapDispatcher {
setMap(map);
}
/**
* Adds <url, page> to the given map. If the URL represents a directory
* (ends with "/"), URL+"index" is also added to the map and URL-"/" is
* redirected to URL.
**/
private void put(Map map, String url, Page page) {
// String url = LegacyInitializer.getURL(key);
if (url.startsWith("/")) {
// Currently the getter method provide a leading slash (API change)
// but the dispatcher needs an url without
// Needs to be checked when the old style sitenode based Dispatcher
// is eliminated.
url = url.substring(1);
}
map.put(url, page);
if (url.endsWith("/")) {
map.put(url+"index", page);
requireTrailingSlash(url.substring(0, url.length()-1));
}
}
@Override
protected void preprocessRequest(HttpServletRequest req,
HttpServletResponse resp,
RequestContext ctx,
@ -139,31 +183,18 @@ public class SubsiteDispatcher extends BebopMapDispatcher {
// /register/login-expired, /register/recover-password
// NB, although you'd think /register is cachable, it
// stores a timestamp in the login form :(
if (url.equals(LegacyInitializer.getURL(LegacyInitializer.COOKIES_PAGE_KEY)) ||
url.equals(LegacyInitializer.getURL(LegacyInitializer.EXPIRED_PAGE_KEY)) ||
url.equals(LegacyInitializer.getURL(LegacyInitializer.RECOVER_PAGE_KEY))) {
//
// url comes without leading "/" and we have to compensate for the
// leading slash provided by the UI.get... methods here.
if (("/"+url).equals(UI.getCookiesExplainPageURL()) ||
("/"+url).equals(UI.getLoginExpiredPageURL()) ||
("/"+url).equals(UI.getRecoverPasswordPageURL()) ) {
DispatcherHelper.cacheForWorld(resp);
} else {
DispatcherHelper.cacheDisable(resp);
}
}
/**
* Adds <url, page> to the given map, where URL is looked up from the
* page map using the given key. If the URL represents a directory
* (ends with "/"), URL+"index" is also added to the map and URL-"/" is
* redirected to URL.
**/
private void put(Map map, String key, Page page) {
String url = LegacyInitializer.getURL(key);
map.put(url, page);
if (url.endsWith("/")) {
map.put(url+"index", page);
requireTrailingSlash(url.substring(0, url.length()-1));
}
}
private static Page checkForPageSubClass() {
//check to see if there is subclass of Page defined in Config
DispatcherConfig dc = DispatcherHelper.getConfig();
@ -199,13 +230,14 @@ public class SubsiteDispatcher extends BebopMapDispatcher {
private static Page buildExpiredPage() {
Page page = PageFactory.buildPage(
APPLICATION_NAME,
new Label(LoginHelper.getMessage("login.loginExpiredPage.title")));
new Label(LoginHelper.getMessage("login.loginExpiredPage.title"))
);
page.add(new SimpleContainer() {
{ // constructor
add(new Label(LoginHelper.getMessage
("login.loginExpiredPage.before")));
add(new DynamicLink("login.loginExpiredPage.link",
LegacyInitializer.LOGIN_PAGE_KEY));
UI.getLoginPageURL() ));
add(new Label(LoginHelper.getMessage
("login.loginExpiredPage.after")));
add(new ElementComponent("subsite:explainLoginExpired",
@ -216,10 +248,15 @@ public class SubsiteDispatcher extends BebopMapDispatcher {
return page;
}
/**
*
* @return
*/
private static Page buildLogOutPage() {
Page page = PageFactory.buildPage(
APPLICATION_NAME,
new Label(LoginHelper.getMessage("Logout")));
new Label(LoginHelper.getMessage("Logout"))
);
page.addActionListener(new UserLogoutListener());
page.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
@ -227,8 +264,7 @@ public class SubsiteDispatcher extends BebopMapDispatcher {
final HttpServletRequest req = state.getRequest();
final String path = LegacyInitializer.getFullURL
(LegacyInitializer.ROOT_PAGE_KEY, req);
final String path = UI.getRootPageURL(req);
throw new ReturnSignal(req, URL.there(req, path));
}

View File

@ -22,7 +22,8 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.EmailAddress;
import com.arsdigita.kernel.PersonName;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.ui.UI;
import com.arsdigita.web.URL;
import com.arsdigita.web.ReturnSignal;
import com.arsdigita.bebop.ColumnPanel;
@ -144,8 +145,9 @@ public class UserEditForm extends UserForm
final HttpServletRequest req = state.getRequest();
final String path = LegacyInitializer.getFullURL
(LegacyInitializer.WORKSPACE_PAGE_KEY, req);
// final String path = LegacyInitializer.getFullURL
// (LegacyInitializer.WORKSPACE_PAGE_KEY, req);
final String path = UI.getWorkspaceURL();
final URL fallback = com.arsdigita.web.URL.there(req, path);

View File

@ -29,11 +29,11 @@ import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.SiteNodeCollection;
import com.arsdigita.kernel.PackageType;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.xml.Element;
import com.arsdigita.ui.UI;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
@ -55,37 +55,40 @@ import org.apache.log4j.Logger;
* @author Sameer Ajmani
* @since 2001-06-01
* @version 1.0
* @version $Id: UserInfo.java 287 2005-02-22 00:29:02Z sskracic $
*
**/
public class UserInfo extends SimpleContainer {
public static final String versionId = "$Id: UserInfo.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log =
Logger.getLogger(UserInfo.class.getName());
// m_contentCenters holds a list of content centers that exist
// on this installation
/** m_contentCenters holds a list of content centers that exist
on this installation */
private List m_contentCenters;
// m_centerSiteNodes contains a mapping of content centers to the
// site nodes where they are mounted.
/** m_centerSiteNodes contains a mapping of content centers to the
site nodes where they are mounted. */
private HashMap m_centerSiteNodes;
private UserAuthenticationListener m_listener =
new UserAuthenticationListener();
new UserAuthenticationListener();
/**
* Constructor.
*/
public UserInfo() {
// add list of links
ListPanel list = new ListPanel(false);
list.add(new DynamicLink("login.userInfo.logoutLink",
LegacyInitializer.LOGOUT_PAGE_KEY));
UI.getLogoutPageURL()));
list.add(new DynamicLink("login.userInfo.editProfileLink",
LegacyInitializer.EDIT_PAGE_KEY));
UI.getEditUserProfilePageURL()));
list.add(new DynamicLink("login.userInfo.changePasswordLink",
LegacyInitializer.CHANGE_PAGE_KEY));
UI.getRecoverPasswordPageURL()));
add(list);
// add user info text
add(new SimpleComponent() {
@Override
public void generateXML(PageState state, Element parent) {
if (!isLoggedIn(state)) {
s_log.debug("user is not logged in, so no XML generated");
@ -99,12 +102,25 @@ public class UserInfo extends SimpleContainer {
if (m_contentCenters == null) {
m_contentCenters = new ArrayList();
m_centerSiteNodes = new HashMap();
// XXX has to refactored!
// used old style packageType to retrieve a list of installed
// content-centers. Odd, there may exist only one content-center per
// installation!
// Currently (version 6.6.0 2011-02-06) content-center = workspace
// exists as legacy application only, not as legacy compatible application!
// retrieve all packages of type content-center
// works because there may be only one.
DataCollection dc = SessionManager.getSession().retrieve
(PackageType.BASE_DATA_OBJECT_TYPE);
dc.addEqualsFilter("packageKey", "content-center");
if (dc.next()) {
// works because there may be only one entry of
// package type content-center
PackageType pt = new PackageType(dc.getDataObject());
dc.close();
PackageInstanceCollection collection = pt.getInstances();
while (collection.next()) {
PackageInstance instance = collection.getPackageInstance();

View File

@ -31,6 +31,7 @@ import com.arsdigita.bebop.parameters.ArrayParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.bebop.parameters.URLParameter;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.ui.UI;
import com.arsdigita.web.Web;
import com.arsdigita.web.URL;
import com.arsdigita.web.ReturnSignal;
@ -43,7 +44,6 @@ import com.arsdigita.kernel.UserAuthentication;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.persistence.PersistenceException;
import javax.mail.internet.InternetAddress;
@ -71,7 +71,6 @@ public class UserNewForm extends UserForm
FormProcessListener,
FormValidationListener
{
public static final String versionId = "$Id: UserNewForm.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log =
Logger.getLogger(UserNewForm.class);
@ -219,8 +218,9 @@ public class UserNewForm extends UserForm
// redirect to workspace or return URL, if specified
final HttpServletRequest req = state.getRequest();
url = LegacyInitializer.getFullURL
(LegacyInitializer.WORKSPACE_PAGE_KEY, req);
// url = LegacyInitializer.getFullURL
// (LegacyInitializer.WORKSPACE_PAGE_KEY, req);
url = UI.getWorkspaceURL();
final URL fallback = com.arsdigita.web.URL.there(req, url);

View File

@ -47,8 +47,9 @@ import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.security.AccountNotFoundException;
import com.arsdigita.kernel.security.Credential;
import com.arsdigita.kernel.security.CredentialException;
import com.arsdigita.kernel.security.LegacyInitializer;
// import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.ui.UI;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.RedirectSignal;
import com.arsdigita.web.ReturnSignal;
@ -69,15 +70,11 @@ import org.apache.log4j.Logger;
* @author Sameer Ajmani
*
* @version $Id: UserRegistrationForm.java 1230 2006-06-22 11:50:59Z apevec $
*
**/
*/
public class UserRegistrationForm extends Form
implements LoginConstants, FormInitListener,
FormValidationListener, FormProcessListener
{
public static final String versionId = "$Id: UserRegistrationForm.java 1230 2006-06-22 11:50:59Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $";
FormValidationListener, FormProcessListener {
private static final Logger s_log =
Logger.getLogger(UserRegistrationForm.class);
@ -114,19 +111,18 @@ public class UserRegistrationForm extends Form
m_autoRegistrationOn = autoRegistrationOn;
m_timestamp = new Hidden(new StringParameter
(FORM_TIMESTAMP));
m_timestamp = new Hidden(new StringParameter (FORM_TIMESTAMP));
add(m_timestamp);
m_returnURL = new Hidden(new URLParameter
(LoginHelper.RETURN_URL_PARAM_NAME));
(LoginHelper.RETURN_URL_PARAM_NAME));
m_returnURL.setPassIn(true);
add(m_returnURL);
setupLogin();
add(new Label(LoginHelper.getMessage
("login.userRegistrationForm.password")));
("login.userRegistrationForm.password")));
m_password = new Password(new StringParameter(FORM_PASSWORD));
// Since new users should not enter a password, allow null.
//m_password.addValidationListener(new NotNullValidationListener());
@ -137,7 +133,7 @@ public class UserRegistrationForm extends Form
new CheckboxGroup(FORM_PERSISTENT_LOGIN_P);
Label optLabel =
new Label(LoginHelper.getMessage
("login.userRegistrationForm.cookieOption"));
("login.userRegistrationForm.cookieOption"));
Option opt = new Option(FORM_PERSISTENT_LOGIN_P_DEFAULT, optLabel);
m_isPersistent.addOption(opt);
if (Kernel.getConfig().isLoginRemembered()) {
@ -146,17 +142,17 @@ public class UserRegistrationForm extends Form
cookiePanel.add(m_isPersistent);
cookiePanel.add(new DynamicLink
("login.userRegistrationForm.explainCookieLink",
LegacyInitializer.COOKIES_PAGE_KEY));
UI.getCookiesExplainPageURL()));
add(cookiePanel);
add(new Submit(SUBMIT), ColumnPanel.CENTER | ColumnPanel.FULL_WIDTH);
add(new DynamicLink("login.userRegistrationForm.forgotPasswordLink",
LegacyInitializer.RECOVER_PAGE_KEY));
UI.getRecoverPasswordPageURL()));
if (m_autoRegistrationOn) {
add(new DynamicLink("login.userRegistrationForm.newUserRegister",
LegacyInitializer.NEWUSER_PAGE_KEY));
UI.getNewUserPageURL()));
}
add(new ElementComponent("subsite:promptToEnableCookiesMsg",
@ -199,7 +195,7 @@ public class UserRegistrationForm extends Form
}
public void init(FormSectionEvent event)
throws FormProcessException {
throws FormProcessException {
s_log.info( "In init" );
if (Kernel.getConfig().isSSOenabled()) {
// try SSO login
@ -241,8 +237,9 @@ public class UserRegistrationForm extends Form
} catch (CredentialException e) {
s_log.info( "Invalid credential" );
final String path = LegacyInitializer.getFullURL
(LegacyInitializer.EXPIRED_PAGE_KEY, state.getRequest());
//final String path = LegacyInitializer.getFullURL
// (LegacyInitializer.EXPIRED_PAGE_KEY, state.getRequest());
final String path = UI.getLoginExpiredPageURL();
final URL url = com.arsdigita.web.URL.there
(state.getRequest(), path);
@ -267,9 +264,8 @@ public class UserRegistrationForm extends Form
final PageState state = event.getPageState();
final HttpServletRequest req = state.getRequest();
// Redirect to workspace or return URL, if specified.
final String path = LegacyInitializer.getFullURL
(LegacyInitializer.LOGIN_REDIRECT_PAGE_KEY, req);
// Redirect to workspace or return URL, if specified.
final String path = UI.getUserRedirectURL(req);
final URL url = com.arsdigita.web.URL.there(req, path);
@ -404,8 +400,9 @@ public class UserRegistrationForm extends Form
}
protected void redirectToNewUserPage(PageState state) {
String url = LegacyInitializer.getFullURL
(LegacyInitializer.NEWUSER_PAGE_KEY, state.getRequest());
// String url = LegacyInitializer.getFullURL
// (LegacyInitializer.NEWUSER_PAGE_KEY, state.getRequest());
String url = UI.getNewUserPageURL();
ParameterMap map = new ParameterMap();
map.setParameter(LoginHelper.RETURN_URL_PARAM_NAME,

View File

@ -34,13 +34,12 @@ import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.ui.UI;
import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/**
@ -69,8 +68,9 @@ class IndexPanel extends SimpleContainer implements PermissionsConstants {
setClassAttr("PERMISSIONS");
m_navbar = new DimensionalNavbar();
m_navbar.add(new Link(PERSONAL_SITE.localize()+"",
"/" + LegacyInitializer.getURL(
LegacyInitializer.WORKSPACE_PAGE_KEY)));
UI.getWorkspaceURL()));
// "/" + LegacyInitializer.getURL(
// LegacyInitializer.WORKSPACE_PAGE_KEY)));
m_navbar.add(new Link(MAIN_SITE.localize()+"", "/"));
m_navbar.add(new Label(PERMISSIONS_INDEX_NAVBAR.localize()+""));
m_navbar.setClassAttr("permNavBar");
@ -87,7 +87,9 @@ class IndexPanel extends SimpleContainer implements PermissionsConstants {
boxpanel.add(m_adminObjs);
m_segmentedPanel = new SegmentedPanel();
m_segmentedPanel.addSegment(new Label(PAGE_OBJECT_PANEL_TITLE.localize()+""), boxpanel);
m_segmentedPanel.addSegment(new Label(
PAGE_OBJECT_PANEL_TITLE.localize()+""),
boxpanel);
add(m_segmentedPanel);
}

View File

@ -21,13 +21,12 @@ package com.arsdigita.ui.permissions;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.DimensionalNavbar;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.security.LegacyInitializer;
import com.arsdigita.ui.UI;
/**
*
@ -68,8 +67,9 @@ class PermissionsHeader extends BoxPanel implements PermissionsConstants {
DimensionalNavbar navbar = new DimensionalNavbar();
navbar.add(new Link(PERSONAL_SITE.localize()+"",
"/" + LegacyInitializer.getURL(
LegacyInitializer.WORKSPACE_PAGE_KEY)));
UI.getWorkspaceURL() ));
// "/" + LegacyInitializer.getURL(
// LegacyInitializer.WORKSPACE_PAGE_KEY)));
navbar.add(new Link(MAIN_SITE.localize()+"", "/"));
navbar.add(new Link(PERMISSIONS_INDEX.localize()+"", "/permissions/"));
navbar.add(objectName);

View File

@ -33,11 +33,11 @@ import org.apache.log4j.Logger;
* servlet (mapped to "/someprefix/*") for requests to the CCM
* webapp.</p>
*
* <p>Upon finding an {@link com.arsdigita.web.Application
* application} at the requested URL, this class sets a request
* attribute storing the ID of the application and forwards to the
* servlet associated with it. If instead no application is found,
* the request is forwarded to the fallback servlet, if defined.</p>
* <p>Upon finding an {@link com.arsdigita.web.Application application} at the
* requested URL, this class sets a request attribute storing the ID of the
* application and forwards to the servlet associated with it. If instead no
* application is found, the request is forwarded to the fallback servlet,
* if defined.</p>
*
* <p>This servlet may be deployed using web.xml entries like
* these:</p>

View File

@ -28,7 +28,12 @@ import javax.servlet.http.HttpServlet;
import org.apache.log4j.Logger;
/**
* The prefixer servlet adds prefixes to chosen classes of requests.
* This is useful if you wish to migrate users off the old dispatcher to
* the new dispatcher, which uses a prefix for URLs. The following
* snippet assumes your dispatcher is mapped to "/ccm/*".
*
* Used by a web.xml entry. (cf. web.xml-core-optional.in)
*
* @author Justin Ross &lt;<a href="mailto:jross@redhat.com">jross@redhat.com</a>&gt;
* @version $Id: PrefixerServlet.java 287 2005-02-22 00:29:02Z sskracic $

View File

@ -1,4 +1,6 @@
<product name="CCM Core" current_version="5.1.1">
<!-- Configuration file for core com.arsdigita.dmi automatic update facility
package. (not in use as of version 6.x.x -->
<product_description>Red Hat CCM Core</product_description>
<version_history database="oracle-se">

View File

@ -1,12 +1,12 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.kernel.security.LegacyInitializer"/>
<jsp:directive.page import="com.arsdigita.ui.UI"/>
<jsp:directive.page import="com.arsdigita.web.URL"/>
<jsp:directive.page import="com.arsdigita.web.RedirectSignal"/>
<jsp:directive.page extends="com.arsdigita.web.BaseJSP"/>
<jsp:scriptlet>
throw new RedirectSignal(URL.there(request,
LegacyInitializer.getFullURL(LegacyInitializer.LOGIN_REDIRECT_PAGE_KEY, request)), false);
throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)),
false);
</jsp:scriptlet>
</jsp:root>

View File

@ -1,115 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:subsite="http://www.arsdigita.com/subsite/1.0"
exclude-result-prefixes="subsite">
<xsl:import href="../../bebop/xsl/bebop.xsl"/>
<!-- this rule matches one user -->
<xsl:template match="subsite:userInfo">
<p><font color="red">subsite:userInfo -&gt; START GERMAN TRANSLATION</font></p>
<hr />
<h3>What we tell other users about you</h3>
In general we identify content that you've posted by your full name.
In an attempt to protect you from unsolicited bulk email (spam), we
keep your email address hidden except from other registered users.
Total privacy is technically feasible but an important element of an
online community is that people can learn from each other. So we try
to make it possible for users with common interests to contact each
other.
<h4>Basic Information</h4>
<ul>
<li> Name: <xsl:value-of select="@name"/> </li>
<li> User ID: <xsl:value-of select="@id"/> </li>
<li> email address: <xsl:value-of select="@email"/> </li>
<li> personal URL: <xsl:value-of select="@URI"/> </li>
<li> screen name: <xsl:value-of select="@screenName"/> </li>
</ul>
<p><font color="red">subsite:userInfo -&gt; END GERMAN TRANSLATION</font></p>
</xsl:template>
<!-- this rule displays information about peristent cookies -->
<xsl:template match="subsite:explainPersistentCookies">
<p><font color="red">subsite:explainPersistentCookies -&gt; START GERMAN TRANSLATION</font></p>
<hr />
Our server can tell your browser to remember certain things, such as
your email address and password. This is convenient for you because,
if you're the only person who uses your computer, you won't have to
keep telling us your email address and password.
<p>
It would be a very bad idea to choose this option if you're using a
shared computer in a library or school. Any subsequent user of this
machine would be able to masquerade as you on our service.
</p>
<p>
Note that you can erase your saved email address and password by
choosing the "log out" option from your workspace.
</p>
<p><font color="red">subsite:explainPersistentCookies -&gt; END GERMAN TRANSLATION</font></p>
</xsl:template>
<!-- this rule displays a message saying the user typed in the wrong
password when logging in -->
<xsl:template match="subsite:badPassword">
<p><font color="red">subsite:badPassword -&gt; START GERMAN TRANSLATION</font></p>
in <xsl:value-of select="@systemHome"/>
<hr />
The password you typed doesn't match what we have in the database. If
you think you made a typo, please back up using your browser and try
again.
<xsl:if test="@offerToEmailPassword='true'">
<p>If you've forgotten your password, you can
<a href="email-password?user_id={@userId}">ask this server to reset
your password and email a new randomly generated password to you</a>
</p>
</xsl:if>
<p><font color="red">subsite:badPassword -&gt; END GERMAN TRANSLATION</font></p>
</xsl:template>
<xsl:template match="subsite:loginPromptMsg">
<p><font color="red">subsite:loginPromptMsg -&gt; START GERMAN TRANSLATION</font></p>
<p><b>Current users:</b> Please enter your email and
password below.</p>
<p><b>New users:</b> Welcome to ACS Developer Central.
Please begin the registration process by entering a
valid email address and a password for signing into
the system. We will direct you to another
form to complete your registration.</p>
<p><font color="red">subsite:loginPromptMsg -&gt; END GERMAN TRANSLATION</font></p>
</xsl:template>
<xsl:template match="subsite:promptToEnableCookiesMsg">
<p><font color="red">subsite:promptToEnableCookiesMsg -&gt; START GERMAN TRANSLATION</font></p>
<p>If you keep getting thrown back here, it is probably because
browser does not accept cookies. We're sorry for the
inconvenience but it really is impossible to program a system
like this without keeping track of who is posting what.</p>
In Netscape 4.0, you can enable cookies from
Edit -&gt; Preferences -&gt; Advanced.
In Microsoft Internet Explorer 4.0, you can enable cookies from
View -&gt; Internet Options -&gt; Advanced -&gt; Security.
<p><font color="red">subsite:promptToEnableCookiesMsg -&gt; END GERMAN TRANSLATION</font></p>
</xsl:template>
</xsl:stylesheet>

View File

@ -16,9 +16,14 @@ waf.kernel.primary_user_identifier=email
; security.properties:
waf.auto_registration_on=false
waf.pagemap.root=portal/
waf.pagemap.workspace=portal/
waf.pagemap.login_redirect=content/content-center-redirect.jsp
# MOVED to ui.Config
#waf.pagemap.root=portal/
#waf.pagemap.workspace=portal/
#waf.pagemap.login_redirect=content/content-center-redirect.jsp
core.ui.pagemap.root_page_url=navigation/
core.ui.pagemap.workspace_url=navigation/
core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp
; Searches for localized style sheet (among others)
waf.templating.stylesheet_resolver=com.arsdigita.templating.PatternStylesheetResolver

View File

@ -14,9 +14,13 @@ waf.kernel.primary_user_identifier=email
; security.properties:
waf.auto_registration_on=false
waf.pagemap.root=portal/
waf.pagemap.workspace=portal/
waf.pagemap.login_redirect=content/content-center-redirect.jsp
# MOVED to ui.Config
#waf.pagemap.root=portal/
#waf.pagemap.workspace=portal/
#waf.pagemap.login_redirect=content/content-center-redirect.jsp
core.ui.pagemap.root_page_url=navigation/
core.ui.pagemap.workspace_url=navigation/
core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp
; Searches for localized style sheet (among others)
waf.templating.stylesheet_resolver=com.arsdigita.templating.PatternStylesheetResolver

View File

@ -16,9 +16,13 @@ waf.kernel.primary_user_identifier=email
; security.properties:
waf.auto_registration_on=false
waf.pagemap.root=portal/
waf.pagemap.workspace=portal/
waf.pagemap.login_redirect=content/content-center-redirect.jsp
# MOVED to ui.Config
#waf.pagemap.root=portal/
#waf.pagemap.workspace=portal/
#waf.pagemap.login_redirect=content/content-center-redirect.jsp
core.ui.pagemap.root_page_url=navigation/
core.ui.pagemap.workspace_url=navigation/
core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp
; Searches for localized style sheet (among others)
waf.templating.stylesheet_resolver=com.arsdigita.templating.PatternStylesheetResolver

View File

@ -14,9 +14,14 @@ waf.kernel.primary_user_identifier=email
; security.properties:
waf.auto_registration_on=false
waf.pagemap.root=navigation/
waf.pagemap.workspace=navigation/
waf.pagemap.login_redirect=content/content-center-redirect.jsp
# MOVED to ui.Config
#waf.pagemap.root=navigation/
#waf.pagemap.workspace=navigation/
#waf.pagemap.login_redirect=content/content-center-redirect.jsp
core.ui.pagemap.root_page_url=navigation/
core.ui.pagemap.workspace_url=navigation/
core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp
; Searches for localized style sheet (among others)
waf.templating.stylesheet_resolver=com.arsdigita.templating.PatternStylesheetResolver

View File

@ -14,9 +14,13 @@ waf.kernel.primary_user_identifier=email
; security.properties:
waf.auto_registration_on=false
waf.pagemap.root=navigation/
waf.pagemap.workspace=navigation/
waf.pagemap.login_redirect=content/content-center-redirect.jsp
# MOVED to ui.Config
#waf.pagemap.root=navigation/
#waf.pagemap.workspace=navigation/
#waf.pagemap.login_redirect=content/content-center-redirect.jsp
core.ui.pagemap.root_page_url=navigation/
core.ui.pagemap.workspace_url=navigation/
core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp
; Searches for localized style sheet (among others)
waf.templating.stylesheet_resolver=com.arsdigita.templating.PatternStylesheetResolver