changed user flow

This commit is contained in:
Timo 2021-04-29 14:46:38 +03:00
parent 00eb12ac9f
commit fe52b718d2
4 changed files with 55 additions and 109 deletions

View File

@ -7,7 +7,7 @@ To re-generate http rune swagger
YOu need swagger-codegen installed `brew install swagger-codegen`
```
BASE=https://redapi-staging.iqser.cloud/
BASE=http://localhost:8080/
URL="$BASE"v2/api-docs?group=redaction-gateway-v1
mkdir -p /tmp/swagger
swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger

View File

@ -68,7 +68,7 @@ export class UserListingScreenComponent extends BaseListingComponent<User> imple
}
private async _loadData() {
this.allEntities = (await this._userControllerService.getAllUsers({ requestId: new Date().toISOString() }, 0, 100).toPromise()).users;
this.allEntities = await this._userControllerService.getAllUsers().toPromise();
this._executeSearchImmediately();
this._computeStats();
this.viewReady = true;

View File

@ -89,8 +89,8 @@ export class UserService {
}
async loadAllUsers() {
const allUsers = await this._userControllerService.getUsers({ requestId: 'users' }, 0, 100).toPromise();
this._allUsers = allUsers.users.filter((u) => this._hasAnyRedRole(u));
const allUsers = await this._userControllerService.getUsers().toPromise();
this._allUsers = allUsers.filter((u) => this._hasAnyRedRole(u));
return allUsers;
}

View File

@ -19,8 +19,6 @@ import { Observable } from 'rxjs';
import { CreateUserRequest } from '../model/createUserRequest';
import { UpdateProfileRequest } from '../model/updateProfileRequest';
import { User } from '../model/user';
import { UserSearchRequest } from '../model/userSearchRequest';
import { UserSearchResponse } from '../model/userSearchResponse';
import { BASE_PATH } from '../variables';
import { Configuration } from '../configuration';
@ -243,75 +241,6 @@ export class UserControllerService {
});
}
/**
* Gets all the users in realm with information of roles.
* None
* @param body userSearchRequest
* @param offset offset
* @param limit limit
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getAllUsers(body: UserSearchRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<UserSearchResponse>;
public getAllUsers(
body: UserSearchRequest,
offset?: number,
limit?: number,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<UserSearchResponse>>;
public getAllUsers(
body: UserSearchRequest,
offset?: number,
limit?: number,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<UserSearchResponse>>;
public getAllUsers(body: UserSearchRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling getAllUsers.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
if (offset !== undefined && offset !== null) {
queryParameters = queryParameters.set('offset', <any>offset);
}
if (limit !== undefined && limit !== null) {
queryParameters = queryParameters.set('limit', <any>limit);
}
let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.request<UserSearchResponse>('post', `${this.basePath}/user/search/red/all`, {
body: body,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
* Gets the user in realm with information of roles.
* None
@ -356,38 +285,17 @@ export class UserControllerService {
/**
* Gets the users who contain redaction roles.
* None
* @param body userSearchRequest
* @param offset offset
* @param limit limit
* @param refreshCache refreshCache
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getUsers(body: UserSearchRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<UserSearchResponse>;
public getUsers(
body: UserSearchRequest,
offset?: number,
limit?: number,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<UserSearchResponse>>;
public getUsers(
body: UserSearchRequest,
offset?: number,
limit?: number,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<UserSearchResponse>>;
public getUsers(body: UserSearchRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling getUsers.');
}
public getUsers(refreshCache?: boolean, observe?: 'body', reportProgress?: boolean): Observable<Array<User>>;
public getUsers(refreshCache?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<User>>>;
public getUsers(refreshCache?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<User>>>;
public getUsers(refreshCache?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
if (offset !== undefined && offset !== null) {
queryParameters = queryParameters.set('offset', <any>offset);
}
if (limit !== undefined && limit !== null) {
queryParameters = queryParameters.set('limit', <any>limit);
if (refreshCache !== undefined && refreshCache !== null) {
queryParameters = queryParameters.set('refreshCache', <any>refreshCache);
}
let headers = this.defaultHeaders;
@ -406,14 +314,52 @@ export class UserControllerService {
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
const consumes: string[] = [];
return this.httpClient.request<Array<User>>('get', `${this.basePath}/user/red`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
* Gets all the users in realm with information of roles.
* None
* @param refreshCache refreshCache
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getAllUsers(refreshCache?: boolean, observe?: 'body', reportProgress?: boolean): Observable<Array<User>>;
public getAllUsers(refreshCache?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<User>>>;
public getAllUsers(refreshCache?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<User>>>;
public getAllUsers(refreshCache?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
if (refreshCache !== undefined && refreshCache !== null) {
queryParameters = queryParameters.set('refreshCache', <any>refreshCache);
}
return this.httpClient.request<UserSearchResponse>('post', `${this.basePath}/user/search/red`, {
body: body,
let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request<Array<User>>('get', `${this.basePath}/user`, {
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,