Search in sources :

Example 56 with SecurityException

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

the class XMLConfigAdmin method resetORMSetting.

public void resetORMSetting() throws SecurityException {
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_ORM);
    if (!hasAccess)
        throw new SecurityException("no access to update ORM Settings");
    Element orm = _getRootElement("orm");
    orm.getParentNode().removeChild(orm);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 57 with SecurityException

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

the class XMLConfigAdmin method setMailDefaultCharset.

/**
 * sets the charset for the mail
 * @param charset
 * @throws SecurityException
 */
public void setMailDefaultCharset(String charset) throws PageException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL);
    if (!hasAccess)
        throw new SecurityException("no access to update mail server settings");
    if (!StringUtil.isEmpty(charset)) {
        try {
            IOUtil.checkEncoding(charset);
        } catch (IOException e) {
            throw Caster.toPageException(e);
        }
    }
    Element mail = _getRootElement("mail");
    mail.setAttribute("default-encoding", charset);
// config.setMailDefaultEncoding(charset);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException)

Example 58 with SecurityException

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

the class XMLConfigAdmin method updateSessionTimeout.

/**
 * updates session timeout value
 * @param span
 * @throws SecurityException
 */
public void updateSessionTimeout(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("sessiontimeout", span.getDay() + "," + span.getHour() + "," + span.getMinute() + "," + span.getSecond());
    else
        scope.removeAttribute("sessiontimeout");
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 59 with SecurityException

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

the class XMLConfigAdmin method updateStorage.

private void updateStorage(String storageName, String storage) throws SecurityException, ApplicationException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update scope setting");
    storage = validateStorage(storage);
    Element scope = _getRootElement("scope");
    if (!StringUtil.isEmpty(storage, true))
        scope.setAttribute(storageName + "storage", storage);
    else
        scope.removeAttribute(storageName + "storage");
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 60 with SecurityException

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

the class XMLConfigAdmin method updateAllowURLRequestTimeout.

public void updateAllowURLRequestTimeout(Boolean allowURLRequestTimeout) throws SecurityException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_SETTING);
    if (!hasAccess)
        throw new SecurityException("no access to update AllowURLRequestTimeout");
    Element scope = _getRootElement("application");
    scope.setAttribute("allow-url-requesttimeout", Caster.toString(allowURLRequestTimeout, ""));
}
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