Search in sources :

Example 66 with SecurityException

use of lucee.runtime.exp.SecurityException in project Lucee by lucee.

the class XMLConfigAdmin method updateComponentDumpTemplate.

/**
 * updates the DebugTemplate
 * @param template
 * @throws SecurityException
 */
public void updateComponentDumpTemplate(String template) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update component setting");
    Element component = _getRootElement("component");
    // if(template.trim().length()>0)
    component.setAttribute("dump-template", template);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 67 with SecurityException

use of lucee.runtime.exp.SecurityException in project Lucee by lucee.

the class XMLConfigAdmin method removeRemoteClient.

public void removeRemoteClient(String url) throws ExpressionException, SecurityException {
    checkWriteAccess();
    // SNSN
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_REMOTE);
    if (!hasAccess)
        throw new SecurityException("no access to remove remote client settings");
    // check parameters
    if (StringUtil.isEmpty(url))
        throw new ExpressionException("url for Remote Client can be a empty value");
    Element clients = _getRootElement("remote-clients");
    Element[] children = XMLConfigWebFactory.getChildren(clients, "remote-client");
    for (int i = 0; i < children.length; i++) {
        String n = children[i].getAttribute("url");
        if (n != null && n.equalsIgnoreCase(url)) {
            clients.removeChild(children[i]);
        }
    }
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException) ExpressionException(lucee.runtime.exp.ExpressionException)

Example 68 with SecurityException

use of lucee.runtime.exp.SecurityException in project Lucee by lucee.

the class XMLConfigAdmin method updateCustomTagDeepSearch.

public void updateCustomTagDeepSearch(boolean customTagDeepSearch) throws SecurityException {
    checkWriteAccess();
    if (!ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CUSTOM_TAG))
        throw new SecurityException("no access to update custom tag setting");
    Element element = _getRootElement("custom-tag");
    element.setAttribute("custom-tag-deep-search", Caster.toString(customTagDeepSearch));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 69 with SecurityException

use of lucee.runtime.exp.SecurityException in project Lucee by lucee.

the class XMLConfigAdmin method updateSuppressContent.

/*public void updateSuppressWhitespace(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("suppress-whitespace",Caster.toString(value,""));
    }*/
public void updateSuppressContent(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("suppress-content", Caster.toString(value, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 70 with SecurityException

use of lucee.runtime.exp.SecurityException in project Lucee by lucee.

the class XMLConfigAdmin method removeCacheDefaultConnection.

public void removeCacheDefaultConnection(int type) throws PageException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_CACHE);
    if (!hasAccess)
        throw new SecurityException("no access to update cache connections");
    Element parent = _getRootElement("cache");
    if (type == ConfigImpl.CACHE_TYPE_OBJECT) {
        parent.removeAttribute("default-object");
    } else if (type == ConfigImpl.CACHE_TYPE_TEMPLATE) {
        parent.removeAttribute("default-template");
    } else if (type == ConfigImpl.CACHE_TYPE_QUERY) {
        parent.removeAttribute("default-query");
    } else if (type == ConfigImpl.CACHE_TYPE_RESOURCE) {
        parent.removeAttribute("default-resource");
    } else if (type == ConfigImpl.CACHE_TYPE_FUNCTION) {
        parent.removeAttribute("default-function");
    } else if (type == ConfigImpl.CACHE_TYPE_INCLUDE) {
        parent.removeAttribute("default-include");
    } else if (type == ConfigImpl.CACHE_TYPE_HTTP) {
        parent.removeAttribute("default-http");
    } else if (type == ConfigImpl.CACHE_TYPE_FILE) {
        parent.removeAttribute("default-file");
    } else if (type == ConfigImpl.CACHE_TYPE_WEBSERVICE) {
        parent.removeAttribute("default-webservice");
    }
}
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