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, ""));
}
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);
}
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"));
}
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, ""));
}
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();
}
Aggregations