use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method setTaskMaxThreads.
/*private void createAbort() {
try {
ConfigWebFactory.getChildByName(doc.getDocumentElement(),"cfabort",true);
}
catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
}*/
public void setTaskMaxThreads(Integer maxThreads) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update task settings");
Element mail = _getRootElement("remote-clients");
mail.setAttribute("max-threads", Caster.toString(maxThreads, ""));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method cacheConnectionExists.
public boolean cacheConnectionExists(String name) throws ExpressionException, SecurityException {
checkReadAccess();
if (!ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_CACHE))
throw new SecurityException("no access to check cache connection");
if (name == null || name.isEmpty())
throw new ExpressionException("name for Cache Connection can not be an empty value");
Element parent = _getRootElement("cache");
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))
return true;
}
return false;
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class ConfigWebUtil method checkGeneralWriteAccess.
public static void checkGeneralWriteAccess(ConfigImpl config, Password password) throws SecurityException {
SecurityManager sm = config.getSecurityManager();
short access = sm.getAccess(SecurityManager.TYPE_ACCESS_WRITE);
if (config instanceof ConfigServer)
access = SecurityManager.ACCESS_PROTECTED;
if (access == SecurityManager.ACCESS_PROTECTED) {
checkPassword(config, "write", password);
} else if (access == SecurityManager.ACCESS_CLOSE) {
throw new SecurityException("can't access, write access is disabled");
}
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class ConfigWebUtil method checkGeneralReadAccess.
public static void checkGeneralReadAccess(ConfigImpl config, Password password) throws SecurityException {
SecurityManager sm = config.getSecurityManager();
short access = sm.getAccess(SecurityManager.TYPE_ACCESS_READ);
if (config instanceof ConfigServer)
access = SecurityManager.ACCESS_PROTECTED;
if (access == SecurityManager.ACCESS_PROTECTED) {
checkPassword(config, "read", password);
} else if (access == SecurityManager.ACCESS_CLOSE) {
throw new SecurityException("can't access, read access is disabled");
}
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateBufferOutput.
public void updateBufferOutput(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("buffering-output", Caster.toString(value, ""));
if (scope.hasAttribute("buffer-output"))
scope.removeAttribute("buffer-output");
}
Aggregations