Search in sources :

Example 81 with SecurityException

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

the class XMLConfigAdmin method updateCTPathCache.

public void updateCTPathCache(Boolean ctPathCache) throws SecurityException {
    checkWriteAccess();
    if (!ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_CUSTOM_TAG))
        throw new SecurityException("no access to update custom tag setting");
    if (!Caster.toBooleanValue(ctPathCache, false))
        config.clearCTCache();
    Element scope = _getRootElement("custom-tag");
    scope.setAttribute("use-cache-path", Caster.toString(ctPathCache, ""));
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 82 with SecurityException

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

the class XMLConfigAdmin method updateUpdate.

/*public void updateRestAllowChanges(Boolean allowChanges) throws SecurityException {
		checkWriteAccess();
        boolean hasAccess=true;// TODO ConfigWebUtil.hasAccess(config,SecurityManager.TYPE_REST);
        if(!hasAccess) throw new SecurityException("no access to update rest setting");
        
        
        Element rest=_getRootElement("rest");
        if(allowChanges==null) {
        	if(rest.hasAttribute("allow-changes"))rest.removeAttribute("allow-changes");
        }
        else rest.setAttribute("allow-changes", Caster.toString(allowChanges.booleanValue()));
	}*/
/**
 * updates update settingd for Lucee
 * @param type
 * @param location
 * @throws SecurityException
 */
public void updateUpdate(String type, String location) throws SecurityException {
    checkWriteAccess();
    if (!(config instanceof ConfigServer)) {
        throw new SecurityException("can't change update setting from this context, access is denied");
    }
    Element update = _getRootElement("update");
    update.setAttribute("type", type);
    try {
        location = HTTPUtil.toURL(location, true).toString();
    } catch (Throwable e) {
        ExceptionUtil.rethrowIfNecessary(e);
    }
    update.setAttribute("location", location);
}
Also used : Element(org.w3c.dom.Element) SecurityException(lucee.runtime.exp.SecurityException)

Example 83 with SecurityException

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

the class XMLConfigAdmin method updateORMSetting.

public void updateORMSetting(ORMConfiguration oc) 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.setAttribute("autogenmap", Caster.toString(oc.autogenmap(), "true"));
    orm.setAttribute("event-handler", Caster.toString(oc.eventHandler(), ""));
    orm.setAttribute("event-handling", Caster.toString(oc.eventHandling(), "false"));
    orm.setAttribute("naming-strategy", Caster.toString(oc.namingStrategy(), ""));
    orm.setAttribute("flush-at-request-end", Caster.toString(oc.flushAtRequestEnd(), "true"));
    orm.setAttribute("cache-provider", Caster.toString(oc.getCacheProvider(), ""));
    orm.setAttribute("cache-config", Caster.toString(oc.getCacheConfig(), "true"));
    orm.setAttribute("catalog", Caster.toString(oc.getCatalog(), ""));
    orm.setAttribute("db-create", ORMConfigurationImpl.dbCreateAsString(oc.getDbCreate()));
    orm.setAttribute("dialect", Caster.toString(oc.getDialect(), ""));
    orm.setAttribute("schema", Caster.toString(oc.getSchema(), ""));
    orm.setAttribute("log-sql", Caster.toString(oc.logSQL(), "false"));
    orm.setAttribute("save-mapping", Caster.toString(oc.saveMapping(), "false"));
    orm.setAttribute("secondary-cache-enable", Caster.toString(oc.secondaryCacheEnabled(), "false"));
    orm.setAttribute("use-db-for-mapping", Caster.toString(oc.useDBForMapping(), "true"));
    orm.setAttribute("orm-config", Caster.toString(oc.getOrmConfig(), ""));
    orm.setAttribute("sql-script", Caster.toString(oc.getSqlScript(), "true"));
    if (oc.isDefaultCfcLocation()) {
        orm.removeAttribute("cfc-location");
    } else {
        Resource[] locations = oc.getCfcLocations();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < locations.length; i++) {
            if (i != 0)
                sb.append(",");
            sb.append(locations[i].getAbsolutePath());
        }
        orm.setAttribute("cfc-location", sb.toString());
    }
    orm.setAttribute("sql-script", Caster.toString(oc.getSqlScript(), "true"));
}
Also used : Element(org.w3c.dom.Element) Resource(lucee.commons.io.res.Resource) SecurityException(lucee.runtime.exp.SecurityException)

Example 84 with SecurityException

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

the class XMLConfigAdmin method updateShowVersion.

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

Example 85 with SecurityException

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

the class XMLConfigAdmin method removeGatewayEntry.

public void removeGatewayEntry(String name) throws PageException {
    checkWriteAccess();
    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManagerImpl.TYPE_GATEWAY);
    if (!hasAccess)
        throw new SecurityException("no access to remove gateway entry");
    _removeGatewayEntry(name);
    _removeAMFEngine();
}
Also used : 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