Search in sources :

Example 41 with SecurityException

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

the class XMLConfigAdmin method updateAllowCompression.

public void updateAllowCompression(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("allow-compression", Caster.toString(value, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 42 with SecurityException

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

the class XMLConfigAdmin method removeCacheConnection.

public void removeCacheConnection(String name) throws ExpressionException, SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_CACHE);
    if (!hasAccess)
        throw new SecurityException("no access to remove cache connection");
    // check parameters
    if (StringUtil.isEmpty(name))
        throw new ExpressionException("name for Cache Connection can not be an empty value");
    Element parent = _getRootElement("cache");
    // remove default flag
    if (name.equalsIgnoreCase(parent.getAttribute("default-object")))
        parent.removeAttribute("default-object");
    if (name.equalsIgnoreCase(parent.getAttribute("default-template")))
        parent.removeAttribute("default-template");
    if (name.equalsIgnoreCase(parent.getAttribute("default-query")))
        parent.removeAttribute("default-query");
    if (name.equalsIgnoreCase(parent.getAttribute("default-resource")))
        parent.removeAttribute("default-resource");
    // remove element
    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)) {
            Map<String, CacheConnection> conns = config.getCacheConnections();
            CacheConnection cc = conns.get(n.toLowerCase());
            if (cc != null) {
                CacheUtil.releaseEL(cc);
            // CacheUtil.removeEL( config instanceof ConfigWeb ? (ConfigWeb) config : null, cc );
            }
            parent.removeChild(children[i]);
        }
    }
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException) CacheConnection(lucee.runtime.cache.CacheConnection) ExpressionException(lucee.runtime.exp.ExpressionException)

Example 43 with SecurityException

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

the class XMLConfigAdmin method updateScopeCascadingType.

/**
 * sets the scope cascading type
 * @param type (ServletConfigImpl.SCOPE_XYZ)
 * @throws SecurityException
 */
public void updateScopeCascadingType(short type) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update scope setting");
    // lucee.print.ln("********........type:"+type);
    Element scope = _getRootElement("scope");
    if (type == ConfigWeb.SCOPE_STRICT)
        scope.setAttribute("cascading", "strict");
    else if (type == ConfigWeb.SCOPE_SMALL)
        scope.setAttribute("cascading", "small");
    else if (type == ConfigWeb.SCOPE_STANDARD)
        scope.setAttribute("cascading", "standard");
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 44 with SecurityException

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

the class XMLConfigAdmin method updateTimeZone.

/**
 * update the timeZone
 * @param timeZone
 * @throws SecurityException
 */
public void updateTimeZone(String timeZone) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update regional setting");
    Element regional = _getRootElement("regional");
    regional.setAttribute("timezone", timeZone.trim());
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 45 with SecurityException

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

the class XMLConfigAdmin method updateLocale.

/**
 * update the locale
 * @param locale
 * @throws SecurityException
 */
public void updateLocale(String locale) throws SecurityException {
    checkWriteAccess();
    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("locale", locale.trim());
}
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