use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateDebugTemplate.
/**
* updates the DebugTemplate
* @param template
* @throws SecurityException
*/
public void updateDebugTemplate(String template) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DEBUGGING);
if (!hasAccess)
throw new SecurityException("no access to change debugging settings");
Element debugging = _getRootElement("debugging");
// if(template.trim().length()>0)
debugging.setAttribute("template", template);
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateResourceProvider.
public void updateResourceProvider(String scheme, ClassDefinition cd, String arguments) throws PageException {
checkWriteAccess();
SecurityManager sm = config.getSecurityManager();
short access = sm.getAccess(SecurityManager.TYPE_FILE);
boolean hasAccess = access == SecurityManager.VALUE_YES;
if (!hasAccess)
throw new SecurityException("no access to update resources");
_updateResourceProvider(scheme, cd, arguments);
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateCGIReadonly.
public void updateCGIReadonly(Boolean cgiReadonly) 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("cgi-readonly", Caster.toString(cgiReadonly, ""));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateLogSettings.
public void updateLogSettings(String name, Level level, ClassDefinition appenderCD, Struct appenderArgs, ClassDefinition layoutCD, Struct layoutArgs) throws PageException {
checkWriteAccess();
// TODO
// boolean hasAccess=ConfigWebUtil.hasAccess(config,SecurityManagerImpl.TYPE_GATEWAY);
// if(!hasAccess) throw new SecurityException("no access to update gateway entry");
// check parameters
name = name.trim();
if (StringUtil.isEmpty(name))
throw new ApplicationException("name can't be a empty value");
if (appenderCD == null || !appenderCD.hasClass())
throw new ExpressionException("you must define appender class");
if (layoutCD == null || !layoutCD.hasClass())
throw new ExpressionException("you must define layout class");
try {
appenderCD.getClazz();
layoutCD.getClazz();
} catch (Exception e) {
throw Caster.toPageException(e);
}
Element parent = _getRootElement("logging");
// Update
Element[] children = XMLConfigWebFactory.getChildren(parent, "logger");
Element el = null;
for (int i = 0; i < children.length; i++) {
String n = children[i].getAttribute("name");
if (name.equalsIgnoreCase(n)) {
el = children[i];
break;
}
}
// Insert
if (el == null) {
el = doc.createElement("logger");
parent.appendChild(el);
el.setAttribute("name", name);
}
/*
// appender
if(appenderCD.getClassName().equals(ConsoleAppender.class.getName())) appenderClassName="console";
if(appenderClassName.equals(RollingResourceAppender.class.getName())) appenderClassName="resource";
// layout
if(layoutClassName.equals(PatternLayout.class.getName())) layoutClassName="pattern";
if(layoutClassName.equals(ClassicLayout.class.getName())) layoutClassName="classic";
if(layoutClassName.equals(HTMLLayout.class.getName())) layoutClassName="html";
if(layoutClassName.equals(XMLLayout.class.getName())) layoutClassName="xml";
*/
el.setAttribute("level", level.toString());
setClass(el, null, "appender-", appenderCD);
el.setAttribute("appender-arguments", toStringCSSStyle(appenderArgs));
setClass(el, null, "layout-", layoutCD);
el.setAttribute("layout-arguments", toStringCSSStyle(layoutArgs));
}
use of lucee.runtime.exp.SecurityException in project Lucee by lucee.
the class XMLConfigAdmin method updateInspectTemplate.
public void updateInspectTemplate(String str) throws SecurityException {
checkWriteAccess();
boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
if (!hasAccess)
throw new SecurityException("no access to update");
Element datasources = _getRootElement("java");
datasources.setAttribute("inspect-template", str);
}
Aggregations