CCM NG: Some cleanup, and new KernelConfig class
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3779 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
aaf0b053d3
commit
712e5c3a4e
|
|
@ -26,7 +26,7 @@ import com.arsdigita.bebop.parameters.BitSetParameter;
|
|||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.util.Traversal;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.SystemInformation;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
|
@ -625,7 +625,7 @@ public class Page extends SimpleComponent implements Container {
|
|||
m_panel.generateXML(state, page);
|
||||
}
|
||||
|
||||
if (KernelConfig.getConfig().isDebugEnabled()
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()
|
||||
&& debugStructure(state.getRequest())) {
|
||||
|
||||
Element structure = page.newChildElement("bebop:structure",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
|
||||
import com.arsdigita.bebop.util.Attributes;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ public class SimpleComponent extends Completable
|
|||
if (m_attr != null) {
|
||||
m_attr.exportAttributes(target);
|
||||
}
|
||||
if (KernelConfig.getConfig().isDebugEnabled() ||
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled() ||
|
||||
Bebop.getConfig().showClassName()) {
|
||||
target.addAttribute("bebop:classname", getClass().getName(),
|
||||
BEBOP_XML_NS);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.arsdigita.bebop.Bebop;
|
|||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.globalization.Globalization;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.templating.XSLParameterGenerator;
|
||||
|
|
@ -454,7 +454,7 @@ public class PageTransformer implements PresentationManager {
|
|||
}
|
||||
|
||||
// copy and paste from BasePresentationManager
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
Document origDoc = (Document) req.getAttribute(
|
||||
"com.arsdigita.xml.Document");
|
||||
Debugger.addDebugger(new TransformationDebugger(template.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
package com.arsdigita.dispatcher;
|
||||
|
||||
//import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.ParameterProvider;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
|
|
@ -1135,7 +1135,7 @@ public final class DispatcherHelper implements DispatcherConstants {
|
|||
* @return The negotiated locale
|
||||
*/
|
||||
public static Locale getNegotiatedLocale() {
|
||||
KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
|
||||
// Set the preferedLocale to the default locale (first entry in the
|
||||
// config parameter list)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
package com.arsdigita.globalization;
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import java.util.Enumeration;
|
||||
import javax.servlet.ServletRequest;
|
||||
import java.util.Locale;
|
||||
|
|
@ -19,7 +19,7 @@ import javax.servlet.http.HttpSession;
|
|||
*/
|
||||
public class GlobalizationHelper {
|
||||
|
||||
public static final String LANG_INDEPENDENT = KernelConfig.getConfig().getLanguagesIndependentCode();
|
||||
public static final String LANG_INDEPENDENT = LegacyKernelConfig.getConfig().getLanguagesIndependentCode();
|
||||
private static final String LANG_PARAM = "lang";
|
||||
|
||||
// Don't instantiate
|
||||
|
|
@ -34,7 +34,7 @@ public class GlobalizationHelper {
|
|||
* @return The negotiated locale
|
||||
*/
|
||||
public static java.util.Locale getNegotiatedLocale() {
|
||||
KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
|
||||
// Set the preferedLocale to the default locale (first entry in the config parameter list)
|
||||
java.util.Locale preferedLocale = getPrefferedLocale();
|
||||
|
|
@ -81,7 +81,7 @@ public class GlobalizationHelper {
|
|||
//
|
||||
// }
|
||||
private static Locale getPrefferedLocale() {
|
||||
KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
java.util.Locale preferedLocale = new java.util.Locale(kernelConfig.getDefaultLanguage(), "", "");
|
||||
return preferedLocale;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
|
||||
* Copyright (C) 2016 LibreCCM Foundation.
|
||||
*
|
||||
* 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.
|
||||
* 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
|
||||
|
|
@ -13,191 +13,202 @@
|
|||
*
|
||||
* 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
|
||||
*
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.EnumerationParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import org.libreccm.configuration.Configuration;
|
||||
import org.libreccm.configuration.Setting;
|
||||
|
||||
/**
|
||||
* @author Justin Ross
|
||||
* @see com.arsdigita.kernel.Kernel
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class KernelConfig extends AbstractConfig {
|
||||
|
||||
/** A logger instance. */
|
||||
private static final Logger s_log = Logger.getLogger(KernelConfig.class);
|
||||
|
||||
/** Singelton config object. */
|
||||
private static KernelConfig s_conf;
|
||||
|
||||
/**
|
||||
* Gain a KernelConfig object.
|
||||
*
|
||||
* Singelton pattern, don't instantiate a KernelConfig object using the
|
||||
* constructor directly!
|
||||
* @return
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public static synchronized KernelConfig getConfig() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new KernelConfig();
|
||||
s_conf.load();
|
||||
}
|
||||
@Configuration(descBundle = "com.arsdigita.kernel.KernelConfigDescription",
|
||||
descKey = "kernel.config.description")
|
||||
public final class KernelConfig {
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
@Setting(descKey = "kernel.config.debug_enabled")
|
||||
private boolean debugEnabled = false;
|
||||
|
||||
/** TODO: should be renamed waf.kernel.debug" */
|
||||
private static Parameter m_debug = new BooleanParameter
|
||||
("waf.debug", Parameter.REQUIRED, Boolean.FALSE);
|
||||
/** Whether WEB development support should be activated (true) or not. */
|
||||
// Handled in OLD initializer c.ad.webdevsupport.LegacyInitializer
|
||||
private static Parameter m_webdevSupport = new BooleanParameter
|
||||
("waf.webdev_support", Parameter.REQUIRED, Boolean.FALSE);
|
||||
private final Parameter m_permissions = new BooleanParameter
|
||||
("waf.kernel.data_permission_check_enabled", Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/** User Login by screen name or email address */
|
||||
private final EnumerationParameter m_identifier = new EnumerationParameter
|
||||
("waf.kernel.primary_user_identifier", Parameter.REQUIRED,
|
||||
"email");
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_SSO = new BooleanParameter
|
||||
("waf.kernel.sso_login", Parameter.REQUIRED, Boolean.FALSE);
|
||||
@Setting(descKey = "kernel.config.webdev_support_enabled")
|
||||
private boolean webdevSupportEnabled = false;
|
||||
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_remember = new BooleanParameter
|
||||
("waf.kernel.remember_login", Parameter.REQUIRED, Boolean.TRUE);
|
||||
@Setting(descKey = "kernel.config.data_permission_check_enabled")
|
||||
private boolean dataPermissionCheckEnabled = true;
|
||||
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_secureLogin = new BooleanParameter
|
||||
("waf.kernel.secure_login", Parameter.REQUIRED, Boolean.FALSE);
|
||||
@Setting(descKey = "kernel.config.primary_user_identifier")
|
||||
private String primaryUserIdentifier = "email";
|
||||
|
||||
/** String containing the supported languages.
|
||||
The first one is considered default. */
|
||||
private final Parameter m_supportedLanguages = new StringParameter
|
||||
("waf.kernel.supported_languages", Parameter.REQUIRED,
|
||||
"en,de,fr,nl,it,pt,es");
|
||||
private final Parameter m_languageIndependentItems = new BooleanParameter
|
||||
("waf.kernel.language_independent_items", Parameter.REQUIRED, Boolean.FALSE);
|
||||
private final Parameter m_languageIndependentCode = new StringParameter
|
||||
("waf.kernel.language_independent_code", Parameter.OPTIONAL,
|
||||
"--");
|
||||
@Setting(descKey = "kernel.config.sso_enabled")
|
||||
private boolean ssoEnabled = false;
|
||||
|
||||
@Setting(descKey = "kernel.config.remember_login_enabled")
|
||||
private boolean rememberLoginEnabled = true;
|
||||
|
||||
@Setting(descKey = "kernel_config.secure_login_enabled")
|
||||
private boolean secureLoginEnabled = false;
|
||||
|
||||
@Setting(descKey = "kernel.config.supported_languages")
|
||||
private Set<String> supportedLanguages = new HashSet<>(
|
||||
Arrays.asList(new String[]{"en"}));
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public KernelConfig() {
|
||||
super();
|
||||
|
||||
// Add recognised Login user identification to enumeration parameter
|
||||
m_identifier.put("email", "email");
|
||||
m_identifier.put("screen_name", "screenName");
|
||||
|
||||
|
||||
register(m_debug);
|
||||
register(m_webdevSupport);
|
||||
register(m_permissions);
|
||||
register(m_identifier);
|
||||
register(m_SSO);
|
||||
register(m_remember);
|
||||
register(m_secureLogin);
|
||||
register(m_supportedLanguages);
|
||||
register(m_languageIndependentItems);
|
||||
register(m_languageIndependentCode);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
|
||||
public final boolean isDebugEnabled() {
|
||||
return ((Boolean) get(m_debug)).booleanValue();
|
||||
public boolean isDebugEnabled() {
|
||||
return debugEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true, if WEB developer support should be activated.
|
||||
*/
|
||||
public final boolean isWebdevSupportActive() {
|
||||
return ((Boolean) get(m_webdevSupport)).booleanValue();
|
||||
public void setDebugEnabled(final boolean debugEnabled) {
|
||||
this.debugEnabled = debugEnabled;
|
||||
}
|
||||
|
||||
public final boolean isDataPermissionCheckEnabled() {
|
||||
return ((Boolean) get(m_permissions)).booleanValue();
|
||||
public boolean isWebdevSupportEnabled() {
|
||||
return webdevSupportEnabled;
|
||||
}
|
||||
|
||||
public final String getPrimaryUserIdentifier() {
|
||||
return (String) get(m_identifier);
|
||||
public void setWebdevSupportEnabled(final boolean webdevSupportEnabled) {
|
||||
this.webdevSupportEnabled = webdevSupportEnabled;
|
||||
}
|
||||
|
||||
public final boolean emailIsPrimaryIdentifier() {
|
||||
return "email".equals(get(m_identifier));
|
||||
public boolean isDataPermissionCheckEnabled() {
|
||||
return dataPermissionCheckEnabled;
|
||||
}
|
||||
|
||||
public final boolean screenNameIsPrimaryIdentifier() {
|
||||
return !emailIsPrimaryIdentifier();
|
||||
public void setDataPermissionCheckEnabled(
|
||||
final boolean dataPermissionCheckEnabled) {
|
||||
this.dataPermissionCheckEnabled = dataPermissionCheckEnabled;
|
||||
}
|
||||
|
||||
public final boolean isSSOenabled() {
|
||||
return ((Boolean) get(m_SSO)).booleanValue();
|
||||
public String getPrimaryUserIdentifier() {
|
||||
return primaryUserIdentifier;
|
||||
}
|
||||
|
||||
// XXX Move this to WebConfig.
|
||||
public final boolean isLoginRemembered() {
|
||||
return ((Boolean) get(m_remember)).booleanValue();
|
||||
public void setPrimaryUserIdentifier(final String primaryUserIdentifier) {
|
||||
if ("screen_name".equals(primaryUserIdentifier)
|
||||
|| "email".equals(primaryUserIdentifier)) {
|
||||
this.primaryUserIdentifier = primaryUserIdentifier;
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Primary user identifier can only be \"screen_name\" or "
|
||||
+ "\"email\"");
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isSecureLoginRequired() {
|
||||
return ((Boolean) get(m_secureLogin)).booleanValue();
|
||||
public boolean isSsoEnabled() {
|
||||
return ssoEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the defaultLanguage flag.
|
||||
*/
|
||||
public final String getDefaultLanguage() {
|
||||
return ((String) get(m_supportedLanguages)).trim().substring(0, 2);
|
||||
public void setSsoEnabled(final boolean ssoEnabled) {
|
||||
this.ssoEnabled = ssoEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the supportedLanguages as String.
|
||||
*/
|
||||
public final String getSupportedLanguages() {
|
||||
return (String) get(m_supportedLanguages);
|
||||
public boolean isRememberLoginEnabled() {
|
||||
return rememberLoginEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the supportedLanguages as StringTokenizer.
|
||||
*/
|
||||
public final StringTokenizer getSupportedLanguagesTokenizer() {
|
||||
return new StringTokenizer(this.getSupportedLanguages(), ",", false);
|
||||
public void setRememberLoginEnabled(final boolean rememberLoginEnabled) {
|
||||
this.rememberLoginEnabled = rememberLoginEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the languagesIndependentCode as String.
|
||||
*/
|
||||
public final String getLanguagesIndependentCode() {
|
||||
return (String) get(m_languageIndependentCode);
|
||||
public boolean isSecureLoginEnabled() {
|
||||
return secureLoginEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true, if language lang is part of supported langs
|
||||
*/
|
||||
public final boolean hasLanguage(String lang) {
|
||||
return ((String) get(m_supportedLanguages)).contains(lang);
|
||||
public void setSecureLoginEnabled(final boolean secureLoginEnabled) {
|
||||
this.secureLoginEnabled = secureLoginEnabled;
|
||||
}
|
||||
|
||||
public final boolean languageIndependentItems() {
|
||||
return ((Boolean) get(m_languageIndependentItems)).booleanValue();
|
||||
public Set<String> getSupportedLanguages() {
|
||||
return supportedLanguages;
|
||||
}
|
||||
|
||||
public void setSupportedLanguages(final Set<String> supportedLanguages) {
|
||||
this.supportedLanguages = supportedLanguages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 61 * hash + (debugEnabled ? 1 : 0);
|
||||
hash = 61 * hash + (webdevSupportEnabled ? 1 : 0);
|
||||
hash = 61 * hash + (dataPermissionCheckEnabled ? 1 : 0);
|
||||
hash = 61 * hash + Objects.hashCode(primaryUserIdentifier);
|
||||
hash = 61 * hash + (ssoEnabled ? 1 : 0);
|
||||
hash = 61 * hash + (rememberLoginEnabled ? 1 : 0);
|
||||
hash = 61 * hash + (secureLoginEnabled ? 1 : 0);
|
||||
hash = 61 * hash + Objects.hashCode(supportedLanguages);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof KernelConfig)) {
|
||||
return false;
|
||||
}
|
||||
final KernelConfig other = (KernelConfig) obj;
|
||||
if (debugEnabled != other.debugEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (webdevSupportEnabled != other.webdevSupportEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (dataPermissionCheckEnabled != other.dataPermissionCheckEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (ssoEnabled != other.ssoEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (rememberLoginEnabled != other.rememberLoginEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (secureLoginEnabled != other.secureLoginEnabled) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(primaryUserIdentifier,
|
||||
other.primaryUserIdentifier)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(supportedLanguages, other.supportedLanguages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
supportedLanguages.forEach(s -> builder.append(s));
|
||||
|
||||
return String.format("%s{ "
|
||||
+ "debugEnabled = %b, "
|
||||
+ "webdevSupportEnabled = %b, "
|
||||
+ "dataPermissionCheckEnabled = %b, "
|
||||
+ "primaryUserIdentifier = \"%s\", "
|
||||
+ "ssoEnabled = %b, "
|
||||
+ "rememberLoginEnabeled = %b, "
|
||||
+ "secureLoginEnabled = %b, "
|
||||
+ "supportedLanguages = \"%s\""
|
||||
+ " }",
|
||||
super.toString(),
|
||||
debugEnabled,
|
||||
webdevSupportEnabled,
|
||||
dataPermissionCheckEnabled,
|
||||
primaryUserIdentifier,
|
||||
ssoEnabled,
|
||||
rememberLoginEnabled,
|
||||
secureLoginEnabled,
|
||||
builder.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* Copyright (C) 2002-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.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.EnumerationParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Justin Ross
|
||||
* @see com.arsdigita.kernel.Kernel
|
||||
* @version $Id$
|
||||
*/
|
||||
public final class LegacyKernelConfig extends AbstractConfig {
|
||||
|
||||
/** A logger instance. */
|
||||
private static final Logger s_log = Logger.getLogger(LegacyKernelConfig.class);
|
||||
|
||||
/** Singelton config object. */
|
||||
private static LegacyKernelConfig s_conf;
|
||||
|
||||
/**
|
||||
* Gain a LegacyKernelConfig object.
|
||||
*
|
||||
* Singelton pattern, don't instantiate a LegacyKernelConfig object using the
|
||||
constructor directly!
|
||||
* @return
|
||||
*/
|
||||
public static synchronized LegacyKernelConfig getConfig() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new LegacyKernelConfig();
|
||||
s_conf.load();
|
||||
}
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
|
||||
/** TODO: should be renamed waf.kernel.debug" */
|
||||
private static Parameter m_debug = new BooleanParameter
|
||||
("waf.debug", Parameter.REQUIRED, Boolean.FALSE);
|
||||
/** Whether WEB development support should be activated (true) or not. */
|
||||
// Handled in OLD initializer c.ad.webdevsupport.LegacyInitializer
|
||||
private static Parameter m_webdevSupport = new BooleanParameter
|
||||
("waf.webdev_support", Parameter.REQUIRED, Boolean.FALSE);
|
||||
private final Parameter m_permissions = new BooleanParameter
|
||||
("waf.kernel.data_permission_check_enabled", Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/** User Login by screen name or email address */
|
||||
private final EnumerationParameter m_identifier = new EnumerationParameter
|
||||
("waf.kernel.primary_user_identifier", Parameter.REQUIRED,
|
||||
"email");
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_SSO = new BooleanParameter
|
||||
("waf.kernel.sso_login", Parameter.REQUIRED, Boolean.FALSE);
|
||||
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_remember = new BooleanParameter
|
||||
("waf.kernel.remember_login", Parameter.REQUIRED, Boolean.TRUE);
|
||||
|
||||
/**
|
||||
* */
|
||||
private final Parameter m_secureLogin = new BooleanParameter
|
||||
("waf.kernel.secure_login", Parameter.REQUIRED, Boolean.FALSE);
|
||||
|
||||
/** String containing the supported languages.
|
||||
The first one is considered default. */
|
||||
private final Parameter m_supportedLanguages = new StringParameter
|
||||
("waf.kernel.supported_languages", Parameter.REQUIRED,
|
||||
"en,de,fr,nl,it,pt,es");
|
||||
private final Parameter m_languageIndependentItems = new BooleanParameter
|
||||
("waf.kernel.language_independent_items", Parameter.REQUIRED, Boolean.FALSE);
|
||||
private final Parameter m_languageIndependentCode = new StringParameter
|
||||
("waf.kernel.language_independent_code", Parameter.OPTIONAL,
|
||||
"--");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public LegacyKernelConfig() {
|
||||
|
||||
// Add recognised Login user identification to enumeration parameter
|
||||
m_identifier.put("email", "email");
|
||||
m_identifier.put("screen_name", "screenName");
|
||||
|
||||
|
||||
register(m_debug);
|
||||
register(m_webdevSupport);
|
||||
register(m_permissions);
|
||||
register(m_identifier);
|
||||
register(m_SSO);
|
||||
register(m_remember);
|
||||
register(m_secureLogin);
|
||||
register(m_supportedLanguages);
|
||||
register(m_languageIndependentItems);
|
||||
register(m_languageIndependentCode);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
|
||||
public final boolean isDebugEnabled() {
|
||||
return ((Boolean) get(m_debug)).booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true, if WEB developer support should be activated.
|
||||
*/
|
||||
public final boolean isWebdevSupportActive() {
|
||||
return ((Boolean) get(m_webdevSupport)).booleanValue();
|
||||
}
|
||||
|
||||
public final boolean isDataPermissionCheckEnabled() {
|
||||
return ((Boolean) get(m_permissions)).booleanValue();
|
||||
}
|
||||
|
||||
public final String getPrimaryUserIdentifier() {
|
||||
return (String) get(m_identifier);
|
||||
}
|
||||
|
||||
public final boolean emailIsPrimaryIdentifier() {
|
||||
return "email".equals(get(m_identifier));
|
||||
}
|
||||
|
||||
public final boolean screenNameIsPrimaryIdentifier() {
|
||||
return !emailIsPrimaryIdentifier();
|
||||
}
|
||||
|
||||
public final boolean isSSOenabled() {
|
||||
return ((Boolean) get(m_SSO)).booleanValue();
|
||||
}
|
||||
|
||||
// XXX Move this to WebConfig.
|
||||
public final boolean isLoginRemembered() {
|
||||
return ((Boolean) get(m_remember)).booleanValue();
|
||||
}
|
||||
|
||||
public final boolean isSecureLoginRequired() {
|
||||
return ((Boolean) get(m_secureLogin)).booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the defaultLanguage flag.
|
||||
*/
|
||||
public final String getDefaultLanguage() {
|
||||
return ((String) get(m_supportedLanguages)).trim().substring(0, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the supportedLanguages as String.
|
||||
*/
|
||||
public final String getSupportedLanguages() {
|
||||
return (String) get(m_supportedLanguages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the supportedLanguages as StringTokenizer.
|
||||
*/
|
||||
public final StringTokenizer getSupportedLanguagesTokenizer() {
|
||||
return new StringTokenizer(this.getSupportedLanguages(), ",", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the languagesIndependentCode as String.
|
||||
*/
|
||||
public final String getLanguagesIndependentCode() {
|
||||
return (String) get(m_languageIndependentCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true, if language lang is part of supported langs
|
||||
*/
|
||||
public final boolean hasLanguage(String lang) {
|
||||
return ((String) get(m_supportedLanguages)).contains(lang);
|
||||
}
|
||||
|
||||
public final boolean languageIndependentItems() {
|
||||
return ((Boolean) get(m_languageIndependentItems)).booleanValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
package com.arsdigita.templating;
|
||||
|
||||
import com.arsdigita.bebop.Bebop;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.ExceptionUnwrapper;
|
||||
import com.arsdigita.util.Exceptions;
|
||||
|
|
@ -193,7 +193,7 @@ public class Templating {
|
|||
template = new XSLTemplate(source);
|
||||
}
|
||||
|
||||
} else if (KernelConfig.getConfig().isDebugEnabled()
|
||||
} else if (LegacyKernelConfig.getConfig().isDebugEnabled()
|
||||
&& template.isModified()) {
|
||||
// XXX referencing Kernel above is a broken dependency.
|
||||
// Debug mode should be captured at a lower level,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
|
||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
|
@ -158,7 +158,7 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
// Screen name
|
||||
m_screenName = new TextField(new StringParameter(
|
||||
USER_FORM_INPUT_SCREEN_NAME));
|
||||
if (KernelConfig.getConfig().screenNameIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().screenNameIsPrimaryIdentifier()) {
|
||||
m_screenName.addValidationListener(new NotEmptyValidationListener());
|
||||
}
|
||||
add(USER_FORM_LABEL_SCREEN_NAME);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.arsdigita.bebop.form.Password;
|
|||
import com.arsdigita.bebop.form.Submit;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
|
|
@ -126,7 +126,7 @@ public class ChangePasswordForm extends Form
|
|||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
final User user = shiro.getUser();
|
||||
|
||||
final Label greeting = new Label(LoginHelper.getMessage(
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
|
@ -285,7 +285,7 @@ public abstract class UserForm extends Form
|
|||
|
||||
final String oldEmail = user.getPrimaryEmailAddress().getAddress();
|
||||
final String email = (String) m_email.getValue(state);
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()
|
||||
&& email != null && !email.equals(oldEmail)) {
|
||||
final User result = userRepository.findByEmailAddress(email);
|
||||
if (result != null) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
"login.userRegistrationForm.cookieOption"));
|
||||
Option opt = new Option(FORM_PERSISTENT_LOGIN_P_DEFAULT, optLabel);
|
||||
m_isPersistent.addOption(opt);
|
||||
if (KernelConfig.getConfig().isLoginRemembered()) {
|
||||
if (LegacyKernelConfig.getConfig().isLoginRemembered()) {
|
||||
m_isPersistent.setOptionSelected(FORM_PERSISTENT_LOGIN_P_DEFAULT);
|
||||
}
|
||||
cookiePanel.add(m_isPersistent);
|
||||
|
|
@ -192,7 +192,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
"subsite:loginPromptMsg",
|
||||
LoginServlet.SUBSITE_NS_URI);
|
||||
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
loginMessage.setClassAttr("email");
|
||||
} else {
|
||||
loginMessage.setClassAttr("screenName");
|
||||
|
|
@ -200,7 +200,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
|
||||
add(loginMessage);
|
||||
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
add(new Label(LoginHelper.getMessage(
|
||||
"login.userRegistrationForm.email")));
|
||||
m_loginName = new TextField(new EmailParameter(FORM_LOGIN));
|
||||
|
|
@ -228,7 +228,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
s_log.info("In init");
|
||||
if (KernelConfig.getConfig().isSSOenabled()) {
|
||||
if (LegacyKernelConfig.getConfig().isSSOenabled()) {
|
||||
// try SSO login
|
||||
s_log.info("trying SSO");
|
||||
// try {
|
||||
|
|
@ -349,7 +349,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
// try {
|
||||
// final CcmSessionContext ctx = Web.getUserContext();
|
||||
// final String username;
|
||||
// if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
// if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
// username = ((InternetAddress) m_loginName.getValue(state)).
|
||||
// getAddress();
|
||||
// } else {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.arsdigita.bebop.form.Hidden;
|
|||
import com.arsdigita.bebop.parameters.ArrayParameter;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
|
|
@ -121,7 +121,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
m_confirm.setValue(state, "");
|
||||
String loginName = (String) m_loginName.getValue(state);
|
||||
if (loginName != null) {
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
m_email.setValue(state, loginName);
|
||||
} else {
|
||||
m_screenName.setValue(state, loginName);
|
||||
|
|
@ -143,7 +143,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
final String firstName = (String) m_firstName.getValue(state);
|
||||
final String lastName = (String) m_lastName.getValue(state);
|
||||
final String screenName;
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
screenName = null;
|
||||
} else {
|
||||
screenName = (String) m_screenName.getValue(state);
|
||||
|
|
@ -175,7 +175,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
|
||||
try {
|
||||
final String loginName;
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
loginName = email;
|
||||
} else {
|
||||
loginName = screenName;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.web;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -48,7 +48,7 @@ public abstract class Debugger {
|
|||
|
||||
public static class DebugParameterListener implements ParameterListener {
|
||||
public void run(HttpServletRequest sreq, ParameterMap map) {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
final String value = sreq.getParameter(DEBUG_PARAMETER);
|
||||
|
||||
if (value != null) {
|
||||
|
|
@ -86,7 +86,7 @@ public abstract class Debugger {
|
|||
private static class DebuggerListLocal extends InternalRequestLocal {
|
||||
@Override
|
||||
protected Object initialValue() {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
return new ArrayList();
|
||||
} else {
|
||||
return null;
|
||||
|
|
@ -95,7 +95,7 @@ public abstract class Debugger {
|
|||
|
||||
@Override
|
||||
protected void clearValue() {
|
||||
if (KernelConfig.getConfig().isDebugEnabled()) {
|
||||
if (LegacyKernelConfig.getConfig().isDebugEnabled()) {
|
||||
ArrayList list = (ArrayList) get();
|
||||
list.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
|
|
@ -202,7 +202,7 @@ public class CcmShiroRealm extends AuthorizingRealm {
|
|||
|
||||
// Depending of the configuration of CCM use the appropriate method
|
||||
// for finding the user in the database.
|
||||
final KernelConfig config = KernelConfig.getConfig();
|
||||
final LegacyKernelConfig config = LegacyKernelConfig.getConfig();
|
||||
final User user;
|
||||
if ("email".equals(config.getPrimaryUserIdentifier())) {
|
||||
user = userRepository.findByEmailAddress(userIdentifier);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import javax.enterprise.inject.Produces;
|
||||
|
|
@ -97,7 +97,7 @@ public class Shiro {
|
|||
}
|
||||
|
||||
public Subject getPublicUser() {
|
||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
if (LegacyKernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||
return buildInternalSubject("public-user@localhost");
|
||||
} else {
|
||||
return buildInternalSubject("public-user");
|
||||
|
|
@ -109,7 +109,7 @@ public class Shiro {
|
|||
}
|
||||
|
||||
public User getUser() {
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
if (kernelConfig.emailIsPrimaryIdentifier()) {
|
||||
return userRepository.findByEmailAddress((String) getSubject().
|
||||
getPrincipal());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
kernel.config.description=Configure several basic properties for LibreCCM
|
||||
|
||||
kernel.config.debug_enabled=Enables or disables WAF debugging
|
||||
kernel.config.kernel.config.webdev_support_enabled=Enables or disables Webdev support
|
||||
kernel.config.kernel.config.data_permission_check_enabled=Enables or disables permissions checks on database writes
|
||||
kernel.config.kernel.config.primary_user_identifier=Determines whether email addresses or screen names are used to authenticate users. Valid values: "screen_name" or "email"
|
||||
kernel.config.kernel.config.sso_enabled=Enables or disables SSO login
|
||||
kernel.config.kernel.config.remember_login_enabled=Determines whether the "remember login" feature is enabled or disabled by default
|
||||
kernel.config.kernel_config.secure_login_enabled=Accept only credentials presented over secure connection?
|
||||
kernel.config.kernel.config.supported_languages=Set the languages supported for this installation (for content creation). Uses the ISO language codes.
|
||||
|
|
@ -63,9 +63,9 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
@RunWith(Arquillian.class)
|
||||
@Category(IntegrationTest.class)
|
||||
public class KernelConfigTest {
|
||||
public class LegacyKernelConfigTest {
|
||||
|
||||
public KernelConfigTest() {
|
||||
public LegacyKernelConfigTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
|
|
@ -109,7 +109,7 @@ public class KernelConfigTest {
|
|||
.addPackage(UriConverter.class.getPackage())
|
||||
.addPackage(ApplicationRepository.class.getPackage())
|
||||
.addPackage(EntityManagerProducer.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameter.class.getPackage())
|
||||
.addPackage(JavaPropertyReader.class.getPackage())
|
||||
|
|
@ -139,7 +139,7 @@ public class KernelConfigTest {
|
|||
|
||||
@Test
|
||||
public void verifyKernelConfig() {
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final LegacyKernelConfig kernelConfig = LegacyKernelConfig.getConfig();
|
||||
|
||||
assertThat(kernelConfig.isDebugEnabled(),
|
||||
is(true));
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.kernel.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.JavaPropertyReader;
|
||||
import com.arsdigita.util.parameter.AbstractParameter;
|
||||
|
|
@ -111,7 +111,7 @@ public class SecurityConfigTest {
|
|||
.addPackage(UriConverter.class.getPackage())
|
||||
.addPackage(ApplicationRepository.class.getPackage())
|
||||
.addPackage(EntityManagerProducer.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ public class ConfigurationManagerTest {
|
|||
assertThat(configuration.getItemsPerPage(), is(20L));
|
||||
assertThat(configuration.getHelpUrl(),
|
||||
is(equalTo("http://www.example.org")));
|
||||
// assertThat(configuration.getLanguages().size(), is(2));
|
||||
// assertThat(configuration.getLanguages(), hasItem("de"));
|
||||
// assertThat(configuration.getLanguages(), hasItem("en"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package org.libreccm.configuration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -42,6 +43,9 @@ public class ExampleConfiguration {
|
|||
@Setting
|
||||
private String helpUrl;
|
||||
|
||||
// @Setting
|
||||
// private Set<String> languages;
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
|
@ -81,4 +85,12 @@ public class ExampleConfiguration {
|
|||
public void setHelpUrl(final String helpUrl) {
|
||||
this.helpUrl = helpUrl;
|
||||
}
|
||||
|
||||
// public Set<String> getLanguages() {
|
||||
// return languages;
|
||||
// }
|
||||
//
|
||||
// private void setLanguages(final Set<String> languages) {
|
||||
// this.languages = languages;
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -136,7 +136,7 @@ public class AuthorizationInterceptorTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -132,7 +132,7 @@ public class GroupManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -146,7 +146,7 @@ public class PermissionCheckerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -137,7 +137,7 @@ public class PermissionManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -132,7 +132,7 @@ public class RoleManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -163,7 +163,7 @@ public class SecuredCollectionTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -163,7 +163,7 @@ public class SecuredIteratorTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -132,7 +132,7 @@ public class ShiroTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.LegacyKernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -133,7 +133,7 @@ public class UserManagerTest {
|
|||
.addPackage(MimeTypeConverter.class.getPackage())
|
||||
.addPackage(EqualsVerifier.class.getPackage())
|
||||
.addPackage(IntegrationTest.class.getPackage())
|
||||
.addPackage(KernelConfig.class.getPackage())
|
||||
.addPackage(LegacyKernelConfig.class.getPackage())
|
||||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -132,3 +132,12 @@ ccm_core.settings_long:
|
|||
ccm_core.settings_string:
|
||||
- object_id: -3500
|
||||
setting_value: http://www.example.org
|
||||
|
||||
ccm_core.settings_enum:
|
||||
- object_id: -3600
|
||||
|
||||
ccm_core.settings_values:
|
||||
- enum_id: -3600
|
||||
value: de
|
||||
- enum_id: -3600
|
||||
value: en
|
||||
|
|
|
|||
Loading…
Reference in New Issue