Search in sources :

Example 71 with SecurityException

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

the class XMLConfigAdmin method updateScriptProtect.

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

Example 72 with SecurityException

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

the class XMLConfigAdmin method updateTypeChecking.

public void updateTypeChecking(Boolean typeChecking) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update");
    Element datasources = _getRootElement("application");
    if (typeChecking == null)
        datasources.removeAttribute("type-checking");
    else
        datasources.setAttribute("type-checking", Caster.toString(typeChecking.booleanValue()));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 73 with SecurityException

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

the class XMLConfigAdmin method updateClientCookies.

/**
 * set if client cookies are enabled or not
 * @param clientCookies
 * @throws SecurityException
 */
public void updateClientCookies(Boolean clientCookies) 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("setclientcookies", Caster.toString(clientCookies, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 74 with SecurityException

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

the class XMLConfigAdmin method updatePSQ.

/**
 * 	update PSQ State
 * @param psq Preserver Single Quote
 * @throws SecurityException
 */
public void updatePSQ(Boolean psq) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DATASOURCE);
    if (!hasAccess)
        throw new SecurityException("no access to update datsource connections");
    Element datasources = _getRootElement("data-sources");
    datasources.setAttribute("psq", Caster.toString(psq, ""));
    if (datasources.hasAttribute("preserve-single-quote"))
        datasources.removeAttribute("preserve-single-quote");
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 75 with SecurityException

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

the class XMLConfigAdmin method updateDebugEntry.

public void updateDebugEntry(String type, String iprange, String label, String path, String fullname, Struct custom) throws SecurityException, IOException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_DEBUGGING);
    if (!hasAccess)
        throw new SecurityException("no access to change debugging settings");
    // leave this, this method throws a exception when ip range is not valid
    IPRange.getInstance(iprange);
    String id = MD5.getDigestAsString(label.trim().toLowerCase());
    type = type.trim();
    iprange = iprange.trim();
    label = label.trim();
    Element debugging = _getRootElement("debugging");
    // Update
    Element[] children = XMLConfigWebFactory.getChildren(debugging, "debug-entry");
    Element el = null;
    for (int i = 0; i < children.length; i++) {
        String _id = children[i].getAttribute("id");
        if (_id != null) {
            if (_id.equals(id)) {
                el = children[i];
                break;
            }
        }
    }
    // Insert
    if (el == null) {
        el = doc.createElement("debug-entry");
        debugging.appendChild(el);
        el.setAttribute("id", id);
    }
    el.setAttribute("type", type);
    el.setAttribute("iprange", iprange);
    el.setAttribute("label", label);
    el.setAttribute("path", path);
    el.setAttribute("fullname", fullname);
    el.setAttribute("custom", toStringURLStyle(custom));
}
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