use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateAllowCompression.
public void updateAllowCompression(Boolean value) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update scope setting");
Element scope = _getRootElement("setting");
scope.setAttribute("allow-compression", Caster.toString(value, ""));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method removeCacheConnection.
public void removeCacheConnection(String name) throws ExpressionException, SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_CACHE);
if (!hasAccess)
throw new SecurityException("no access to remove cache connection");
// check parameters
if (StringUtil.isEmpty(name))
throw new ExpressionException("name for Cache Connection can not be an empty value");
Element parent = _getRootElement("cache");
// remove default flag
if (name.equalsIgnoreCase(parent.getAttribute("default-object")))
parent.removeAttribute("default-object");
if (name.equalsIgnoreCase(parent.getAttribute("default-template")))
parent.removeAttribute("default-template");
if (name.equalsIgnoreCase(parent.getAttribute("default-query")))
parent.removeAttribute("default-query");
if (name.equalsIgnoreCase(parent.getAttribute("default-resource")))
parent.removeAttribute("default-resource");
// remove element
Element[] children = XMLConfigWebFactory.getChildren(parent, "connection");
for (int i = 0; i < children.length; i++) {
String n = children[i].getAttribute("name");
if (n != null && n.equalsIgnoreCase(name)) {
Map<String, CacheConnection> conns = config.getCacheConnections();
CacheConnection cc = conns.get(n.toLowerCase());
if (cc != null) {
CacheUtil.releaseEL(cc);
// CacheUtil.removeEL( config instanceof ConfigWeb ? (ConfigWeb) config : null, cc );
}
parent.removeChild(children[i]);
}
}
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateScopeCascadingType.
/**
* sets the scope cascading type
* @param type (ServletConfigImpl.SCOPE_XYZ)
* @throws SecurityException
*/
public void updateScopeCascadingType(short type) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update scope setting");
// lucee.print.ln("********........type:"+type);
Element scope = _getRootElement("scope");
if (type == ConfigWeb.SCOPE_STRICT)
scope.setAttribute("cascading", "strict");
else if (type == ConfigWeb.SCOPE_SMALL)
scope.setAttribute("cascading", "small");
else if (type == ConfigWeb.SCOPE_STANDARD)
scope.setAttribute("cascading", "standard");
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateTimeZone.
/**
* update the timeZone
* @param timeZone
* @throws SecurityException
*/
public void updateTimeZone(String timeZone) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update regional setting");
Element regional = _getRootElement("regional");
regional.setAttribute("timezone", timeZone.trim());
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateLocale.
/**
* update the locale
* @param locale
* @throws SecurityException
*/
public void updateLocale(String locale) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update regional setting");
Element scope = _getRootElement("regional");
scope.setAttribute("locale", locale.trim());
}
Aggregations