use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class BackendApiResource method setAuthenticatedUser.
/**
* Set a link to the user of the current session
* (the 'authenticated user') in the API object.
* This link enables users a convenient way to see
* which is the logged-in user, using the system.
*/
private void setAuthenticatedUser(Api api) {
QueryReturnValue returnValue = runQuery(QueryType.GetUserBySessionId, new QueryParametersBase());
DbUser authenticatedUser = (DbUser) returnValue.getReturnValue();
User user = new User();
user.setId(authenticatedUser.getId().toString());
LinkHelper.addLinks(user);
api.setAuthenticatedUser(user);
api.setEffectiveUser(user);
// currently the authenticated and effective users are the same one,
// but if and when impersonation is introduced, they may be different.
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class BackendUsersResource method add.
@Override
public Response add(User user) {
validateParameters(user, "userName");
List<String> authzProvidersNames = getBackendCollection(String.class, QueryType.GetDomainList, new QueryParametersBase());
if (AuthzUtils.getAuthzNameFromEntityName(user.getUserName(), authzProvidersNames) == null) {
// user-name may contain the domain (e.g: oliel@xxx.yyy)
validateParameters(user, "domain.id|name");
}
String domain = getAuthzProviderName(user, authzProvidersNames);
DirectoryUser directoryUser = findDirectoryUser(domain, user);
if (directoryUser == null) {
return Response.status(Status.BAD_REQUEST).entity("No such user: " + user.getUserName() + " in domain " + domain).build();
}
AddUserParameters parameters = new AddUserParameters(new DbUser(directoryUser));
QueryIdResolver<Guid> resolver = new QueryIdResolver<>(QueryType.GetDbUserByUserId, IdQueryParameters.class);
return performCreate(ActionType.AddUser, parameters, resolver, BaseResource.class);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method getAAAProfilesListViaPublic.
public void getAAAProfilesListViaPublic(AsyncQuery<List<String>> aQuery, boolean passwordBasedOnly) {
convertAAAProfilesResult(aQuery, passwordBasedOnly);
Frontend.getInstance().runPublicQuery(QueryType.GetAAAProfileList, new QueryParametersBase(), aQuery);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method getClusterListByService.
public void getClusterListByService(AsyncQuery<List<Cluster>> aQuery, final boolean supportsVirtService, final boolean supportsGlusterService) {
aQuery.converterCallback = source -> {
if (source != null) {
ArrayList<Cluster> list = getClusterByServiceList((ArrayList<Cluster>) source, supportsVirtService, supportsGlusterService);
Collections.sort(list, new NameableComparator());
return list;
}
return new ArrayList<>();
};
Frontend.getInstance().runQuery(QueryType.GetAllClusters, new QueryParametersBase(), aQuery);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method getDefaultConfigurationVersion.
private void getDefaultConfigurationVersion(final LoginModel loginModel) {
AsyncQuery<QueryReturnValue> callback = new AsyncQuery<>(returnValue -> {
if (returnValue != null) {
_defaultConfigurationVersion = ((QueryReturnValue) returnValue).getReturnValue();
} else {
_defaultConfigurationVersion = GENERAL;
}
loginModel.getLoggedInEvent().raise(loginModel, EventArgs.EMPTY);
});
callback.setHandleFailure(true);
Frontend.getInstance().runQuery(QueryType.GetDefaultConfigurationVersion, new QueryParametersBase(), callback);
}
Aggregations