use of org.ovirt.engine.api.restapi.LocalConfig in project ovirt-engine by oVirt.
the class BaseBackendResource method isFiltered.
/**
* Indicate whether data retrieval should be filtered according to user permissions.
*
* @return true if data should be filtered, otherwise queries are executed as admin.
*/
protected boolean isFiltered() {
Boolean result = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, FILTER, true, null);
if (result == null) {
DbUser user = getCurrent().getUser();
if (!user.isAdmin()) {
LocalConfig config = LocalConfig.getInstance();
result = config.getFilterByDefault();
} else {
result = Boolean.FALSE;
}
}
return result;
}
use of org.ovirt.engine.api.restapi.LocalConfig in project ovirt-engine by oVirt.
the class VersionFilter method init.
@Override
public void init(FilterConfig config) throws ServletException {
LocalConfig localConfig = LocalConfig.getInstance();
// Get the supported and default versions:
supportedVersions = localConfig.getSupportedVersions();
defaultVersion = localConfig.getDefaultVersion();
// Get the information about deprecated versions and store them in a set and a map for easy/fast access:
Set<DeprecatedVersionInfo> deprecatedVersionInfos = localConfig.getDeprecatedVersions();
deprecatedVersionsSet = deprecatedVersionInfos.stream().map(DeprecatedVersionInfo::getVersion).collect(toSet());
deprecatedVersionsMap = deprecatedVersionInfos.stream().collect(toMap(DeprecatedVersionInfo::getVersion, identity()));
}
Aggregations