Search in sources :

Example 21 with SecurityException

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

the class XMLConfigAdmin method updateDefaultResourceProvider.

public void updateDefaultResourceProvider(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");
    Element parent = _getRootElement("resources");
    // Update
    Element[] children = XMLConfigWebFactory.getChildren(parent, "default-resource-provider");
    for (int i = 0; i < children.length; i++) {
        Element el = children[i];
        el.setAttribute("arguments", arguments);
        return;
    }
    // Insert
    Element el = doc.createElement("default-resource-provider");
    parent.appendChild(el);
    el.setAttribute("arguments", arguments);
    setClass(el, null, "", cd);
}
Also used : SecurityManager(lucee.runtime.security.SecurityManager) Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 22 with SecurityException

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

the class XMLConfigAdmin method updateApplicationTimeout.

/**
 * updates request timeout value
 * @param span
 * @throws SecurityException
 */
public void updateApplicationTimeout(TimeSpan span) 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");
    if (span != null)
        scope.setAttribute("applicationtimeout", span.getDay() + "," + span.getHour() + "," + span.getMinute() + "," + span.getSecond());
    else
        scope.removeAttribute("applicationtimeout");
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 23 with SecurityException

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

the class XMLConfigAdmin method updateLocalMode.

public void updateLocalMode(String mode) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update scope setting");
    mode = mode.toLowerCase().trim();
    Element scope = _getRootElement("scope");
    scope.setAttribute("local-mode", mode);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 24 with SecurityException

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

the class XMLConfigAdmin method updateComponentUseShadow.

public void updateComponentUseShadow(Boolean useShadow) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update use-shadow");
    Element scope = _getRootElement("component");
    scope.setAttribute("use-shadow", Caster.toString(useShadow, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 25 with SecurityException

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

the class XMLConfigAdmin method updateClientManagement.

/**
 * enable or desable client management
 * @param clientManagement
 * @throws SecurityException
 */
public void updateClientManagement(Boolean clientManagement) 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("clientmanagement", Caster.toString(clientManagement, ""));
}
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