Search in sources :

Example 1 with LocalConfig

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;
}
Also used : LocalConfig(org.ovirt.engine.api.restapi.LocalConfig) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Example 2 with LocalConfig

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()));
}
Also used : LocalConfig(org.ovirt.engine.api.restapi.LocalConfig) DeprecatedVersionInfo(org.ovirt.engine.api.restapi.DeprecatedVersionInfo)

Aggregations

LocalConfig (org.ovirt.engine.api.restapi.LocalConfig)2 DeprecatedVersionInfo (org.ovirt.engine.api.restapi.DeprecatedVersionInfo)1 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)1