use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateCPPCFX.
public void updateCPPCFX(String name, String procedure, String strServerLibrary, boolean keepAlive) throws PageException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CFX_SETTING);
if (!hasAccess)
throw new SecurityException("no access to change cfx settings");
// name
if (StringUtil.isEmpty(name))
throw new ExpressionException("name cannot be a empty value");
// serverLibrary
if (StringUtil.isEmpty(strServerLibrary))
throw new ExpressionException("serverLibrary cannot be a empty value");
Resource serverLibrary = ResourceUtil.toResourceExisting(config, strServerLibrary);
// procedure
if (StringUtil.isEmpty(procedure))
throw new ExpressionException("procedure cannot be a empty value");
renameOldstyleCFX();
Element tags = _getRootElement("ext-tags");
// Update
Element[] children = XMLConfigWebFactory.getChildren(tags, "ext-tag");
for (int i = 0; i < children.length; i++) {
String n = children[i].getAttribute("name");
if (n != null && n.equalsIgnoreCase(name)) {
Element el = children[i];
if (!"cpp".equalsIgnoreCase(el.getAttribute("type")))
throw new ExpressionException("there is already a java cfx tag with this name");
el.setAttribute("server-library", serverLibrary.getAbsolutePath());
el.setAttribute("procedure", procedure);
el.setAttribute("keep-alive", Caster.toString(keepAlive));
el.setAttribute("type", "cpp");
return;
}
}
// Insert
Element el = doc.createElement("ext-tag");
tags.appendChild(el);
el.setAttribute("server-library", serverLibrary.getAbsolutePath());
el.setAttribute("procedure", procedure);
el.setAttribute("keep-alive", Caster.toString(keepAlive));
el.setAttribute("name", name);
el.setAttribute("type", "cpp");
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateCachedWithin.
public void updateCachedWithin(int type, Object value) throws SecurityException, ApplicationException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update cachedwithin setting");
String t = AppListenerUtil.toCachedWithinType(type, "");
if (t == null)
throw new ApplicationException("invalid cachedwithin type defintion");
String v = Caster.toString(value, null);
Element app = _getRootElement("application");
if (v != null)
app.setAttribute("cached-within-" + t, v);
else
app.removeAttribute("cached-within-" + t);
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateComponentDataMemberDefaultAccess.
/**
* update the Component Data Member default access type
* @param strAccess
* @throws SecurityException
* @throws ExpressionException
*/
public void updateComponentDataMemberDefaultAccess(String strAccess) throws SecurityException, ApplicationException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update component setting");
Element scope = _getRootElement("component");
if (StringUtil.isEmpty(strAccess)) {
scope.setAttribute("data-member-default-access", "");
} else {
scope.setAttribute("data-member-default-access", ComponentUtil.toStringAccess(ComponentUtil.toIntAccess(strAccess)));
}
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateContentLength.
public void updateContentLength(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("content-length", Caster.toString(value, ""));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateComponentPathCache.
public void updateComponentPathCache(Boolean componentPathCache) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update component Cache Path");
Element scope = _getRootElement("component");
if (!Caster.toBooleanValue(componentPathCache, false))
config.clearComponentCache();
scope.setAttribute("use-cache-path", Caster.toString(componentPathCache, ""));
}
Aggregations