Search in sources :

Example 86 with SecurityException

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

the class XMLConfigAdmin method setTaskMaxThreads.

/*private void createAbort() {
    	try {
	    	ConfigWebFactory.getChildByName(doc.getDocumentElement(),"cfabort",true);
    	}
    	catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
    }*/
public void setTaskMaxThreads(Integer maxThreads) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update task settings");
    Element mail = _getRootElement("remote-clients");
    mail.setAttribute("max-threads", Caster.toString(maxThreads, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 87 with SecurityException

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

the class XMLConfigAdmin method cacheConnectionExists.

public boolean cacheConnectionExists(String name) throws ExpressionException, SecurityException {
    checkReadAccess();
    if (!ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_CACHE))
        throw new SecurityException("no access to check cache connection");
    if (name == null || name.isEmpty())
        throw new ExpressionException("name for Cache Connection can not be an empty value");
    Element parent = _getRootElement("cache");
    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))
            return true;
    }
    return false;
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException) ExpressionException(lucee.runtime.exp.ExpressionException)

Example 88 with SecurityException

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

the class ConfigWebUtil method checkGeneralWriteAccess.

public static void checkGeneralWriteAccess(ConfigImpl config, Password password) throws SecurityException {
    SecurityManager sm = config.getSecurityManager();
    short access = sm.getAccess(SecurityManager.TYPE_ACCESS_WRITE);
    if (config instanceof ConfigServer)
        access = SecurityManager.ACCESS_PROTECTED;
    if (access == SecurityManager.ACCESS_PROTECTED) {
        checkPassword(config, "write", password);
    } else if (access == SecurityManager.ACCESS_CLOSE) {
        throw new SecurityException("can't access, write access is disabled");
    }
}
Also used : SecurityManager(lucee.runtime.security.SecurityManager) SecurityException(lucee.runtime.exp.SecurityException)

Example 89 with SecurityException

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

the class ConfigWebUtil method checkGeneralReadAccess.

public static void checkGeneralReadAccess(ConfigImpl config, Password password) throws SecurityException {
    SecurityManager sm = config.getSecurityManager();
    short access = sm.getAccess(SecurityManager.TYPE_ACCESS_READ);
    if (config instanceof ConfigServer)
        access = SecurityManager.ACCESS_PROTECTED;
    if (access == SecurityManager.ACCESS_PROTECTED) {
        checkPassword(config, "read", password);
    } else if (access == SecurityManager.ACCESS_CLOSE) {
        throw new SecurityException("can't access, read access is disabled");
    }
}
Also used : SecurityManager(lucee.runtime.security.SecurityManager) SecurityException(lucee.runtime.exp.SecurityException)

Example 90 with SecurityException

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

the class XMLConfigAdmin method updateBufferOutput.

public void updateBufferOutput(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("buffering-output", Caster.toString(value, ""));
    if (scope.hasAttribute("buffer-output"))
        scope.removeAttribute("buffer-output");
}
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