Search in sources :

Example 61 with SecurityException

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);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 62 with SecurityException

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);
}
Also used : SecurityManager(lucee.runtime.security.SecurityManager) SecurityException(lucee.runtime.exp.SecurityException)

Example 63 with SecurityException

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, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 64 with SecurityException

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));
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) Element(org.w3c.dom.Element) ExpressionException(lucee.runtime.exp.ExpressionException) FunctionLibException(lucee.transformer.library.function.FunctionLibException) PageException(lucee.runtime.exp.PageException) ConverterException(lucee.runtime.converter.ConverterException) SecurityException(lucee.runtime.exp.SecurityException) TagLibException(lucee.transformer.library.tag.TagLibException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) CFXTagException(lucee.runtime.cfx.CFXTagException) BundleException(org.osgi.framework.BundleException) SAXException(org.xml.sax.SAXException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ClassException(lucee.commons.lang.ClassException) DOMException(org.w3c.dom.DOMException) MalformedURLException(java.net.MalformedURLException) ExpressionException(lucee.runtime.exp.ExpressionException) ApplicationException(lucee.runtime.exp.ApplicationException) HTTPException(lucee.runtime.exp.HTTPException)

Example 65 with SecurityException

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);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Aggregations

SecurityException (lucee.runtime.exp.SecurityException)91 Element (org.w3c.dom.Element)83 ExpressionException (lucee.runtime.exp.ExpressionException)14 SecurityManager (lucee.runtime.security.SecurityManager)6 ApplicationException (lucee.runtime.exp.ApplicationException)5 IOException (java.io.IOException)4 Resource (lucee.commons.io.res.Resource)2 ClassException (lucee.commons.lang.ClassException)2 PageException (lucee.runtime.exp.PageException)2 ServiceException (coldfusion.server.ServiceException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 UnknownHostException (java.net.UnknownHostException)1 SQLException (java.sql.SQLException)1 Entry (java.util.Map.Entry)1 lucee.aprint (lucee.aprint)1 Cache (lucee.commons.io.cache.Cache)1 FileResourceProvider (lucee.commons.io.res.type.file.FileResourceProvider)1 CacheConnection (lucee.runtime.cache.CacheConnection)1 CFXTagException (lucee.runtime.cfx.CFXTagException)1