use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateQueue.
public void updateQueue(Integer max, Integer timeout, Boolean enable) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update queue settings");
Element queue = _getRootElement("queue");
// max
if (max == null)
queue.removeAttribute("max");
else
queue.setAttribute("max", Caster.toString(max, ""));
// total
if (timeout == null)
queue.removeAttribute("timeout");
else
queue.setAttribute("timeout", Caster.toString(timeout, ""));
// enable
if (enable == null)
queue.removeAttribute("enable");
else
queue.setAttribute("enable", Caster.toString(enable, ""));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateTimeServer.
/**
* update the timeServer
* @param timeServer
* @param useTimeServer
* @throws PageException
*/
public void updateTimeServer(String timeServer, Boolean useTimeServer) throws PageException {
checkWriteAccess();
if (useTimeServer != null && useTimeServer.booleanValue() && !StringUtil.isEmpty(timeServer, true)) {
try {
new NtpClient(timeServer).getOffset();
} catch (IOException e) {
try {
new NtpClient(timeServer).getOffset();
} catch (IOException ee) {
throw Caster.toPageException(ee);
}
}
}
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("timeserver", timeServer.trim());
if (useTimeServer != null)
scope.setAttribute("use-timeserver", Caster.toString(useTimeServer));
else
scope.removeAttribute("use-timeserver");
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateProxy.
public void updateProxy(boolean enabled, String server, int port, String username, String password) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update listener type");
Element proxy = _getRootElement("proxy");
proxy.setAttribute("enabled", Caster.toString(enabled));
if (!StringUtil.isEmpty(server))
proxy.setAttribute("server", server);
if (port > 0)
proxy.setAttribute("port", Caster.toString(port));
if (!StringUtil.isEmpty(username))
proxy.setAttribute("username", username);
if (!StringUtil.isEmpty(password))
proxy.setAttribute("password", password);
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateSessionManagement.
/*public void removeProxy() throws SecurityException {
boolean hasAccess=ConfigWebUtil.hasAccess(config,SecurityManager.TYPE_SETTING);
if(!hasAccess) throw new SecurityException("no access to remove proxy settings");
Element proxy=_getRootElement("proxy");
proxy.removeAttribute("server");
proxy.removeAttribute("port");
proxy.removeAttribute("username");
proxy.removeAttribute("password");
}*/
/**
* enable or desable session management
* @param sessionManagement
* @throws SecurityException
*/
public void updateSessionManagement(Boolean sessionManagement) 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("scope");
scope.setAttribute("sessionmanagement", Caster.toString(sessionManagement, ""));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateCacheDefaultConnection.
public void updateCacheDefaultConnection(int type, String name) throws PageException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_CACHE);
if (!hasAccess)
throw new SecurityException("no access to update cache default connections");
Element parent = _getRootElement("cache");
if (type == ConfigImpl.CACHE_TYPE_OBJECT) {
parent.setAttribute("default-object", name);
} else if (type == ConfigImpl.CACHE_TYPE_TEMPLATE) {
parent.setAttribute("default-template", name);
} else if (type == ConfigImpl.CACHE_TYPE_QUERY) {
parent.setAttribute("default-query", name);
} else if (type == ConfigImpl.CACHE_TYPE_RESOURCE) {
parent.setAttribute("default-resource", name);
} else if (type == ConfigImpl.CACHE_TYPE_FUNCTION) {
parent.setAttribute("default-function", name);
} else if (type == ConfigImpl.CACHE_TYPE_INCLUDE) {
parent.setAttribute("default-include", name);
} else if (type == ConfigImpl.CACHE_TYPE_HTTP) {
parent.setAttribute("default-http", name);
} else if (type == ConfigImpl.CACHE_TYPE_FILE) {
parent.setAttribute("default-file", name);
} else if (type == ConfigImpl.CACHE_TYPE_WEBSERVICE) {
parent.setAttribute("default-webservice", name);
}
}
Aggregations