Add user merge related services and updates on existing services on the frontend
This commit is contained in:
parent
e1212383ff
commit
9674ec2b6b
|
@ -94,7 +94,7 @@ public class UserManager {
|
|||
public List<UserCredential> getCredentials(UUID userId) {
|
||||
List<UserCredential> results = new ArrayList<>();
|
||||
eu.eudat.data.entities.UserInfo user = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().find(userId);
|
||||
List<Credential> credentials = apiContext.getOperationsContext().getDatabaseRepository().getCredentialDao().asQueryable().where((builder, root) -> builder.equal(root.get("userInfo").get("id"), userId)).toList();
|
||||
List<Credential> credentials = apiContext.getOperationsContext().getDatabaseRepository().getCredentialDao().asQueryable().where((builder, root) -> builder.equal(root.get("userInfo"), user)).toList();
|
||||
credentials.forEach(credential -> {
|
||||
UserCredential userCredential = new UserCredential();
|
||||
userCredential.setEmail(credential.getEmail());
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
export class UserMergeRequestModel {
|
||||
userId: String;
|
||||
email: String;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import { AuthProvider } from '@app/core/common/enum/auth-provider';
|
||||
|
||||
export class UserCredentialModel {
|
||||
email: string;
|
||||
provider: AuthProvider;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from "@angular/core";
|
||||
import { BaseHttpService } from "../http/base-http.service";
|
||||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { UserMergeRequestModel } from '@app/core/model/merge/user-merge-request';
|
||||
|
||||
@Injectable()
|
||||
export class MergeEmailConfirmationService {
|
||||
private actioUrl: string;
|
||||
private headers: HttpHeaders
|
||||
|
||||
constructor(private http: BaseHttpService, private configurationService: ConfigurationService) {
|
||||
this.actioUrl = configurationService.server + 'emailMergeConfirmation/';
|
||||
}
|
||||
|
||||
public emailConfirmation(token: string) {
|
||||
return this.http.get<String>(this.actioUrl + token, { headers: this.headers });
|
||||
}
|
||||
|
||||
public sendConfirmationEmail(mergeRequest: UserMergeRequestModel) {
|
||||
return this.http.post<String>(this.actioUrl, mergeRequest, { headers: this.headers });
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import { UserListingModel } from '../../model/user/user-listing';
|
|||
import { UserCriteria } from '../../query/user/user-criteria';
|
||||
import { BaseHttpService } from '../http/base-http.service';
|
||||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { UserCredentialModel } from '@app/core/model/user/user-credential';
|
||||
|
||||
@Injectable()
|
||||
export class UserService {
|
||||
|
@ -28,6 +29,10 @@ export class UserService {
|
|||
return this.http.get<UserListingModel>(this.actionUrl + id, { headers: this.headers });
|
||||
}
|
||||
|
||||
getEmails(id: String): Observable<UserCredentialModel[]> {
|
||||
return this.http.get<UserCredentialModel[]>(`${this.actionUrl}${id}/emails`, { headers: this.headers });
|
||||
}
|
||||
|
||||
updateRoles(itemToUpdate: UserListingModel): Observable<UserListingModel> {
|
||||
return this.http.post<UserListingModel>(this.actionUrl + 'updateRoles', JSON.stringify(itemToUpdate), { headers: this.headers });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue