[AAE-5343] add update person api (#7426)

* add update person api

* fix e2e tests
This commit is contained in:
Denys Vuika
2021-12-16 11:08:09 +00:00
committed by GitHub
parent 75adf217d1
commit 65a9d2bbfa
3 changed files with 20 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service';
import { catchError, map } from 'rxjs/operators';
import { PersonEntry, PeopleApi, PersonBodyCreate, Pagination } from '@alfresco/js-api';
import { PersonEntry, PeopleApi, PersonBodyCreate, Pagination, PersonBodyUpdate } from '@alfresco/js-api';
import { EcmUserModel } from '../models/ecm-user.model';
import { LogService } from './log.service';
@@ -117,6 +117,20 @@ export class PeopleContentService {
);
}
/**
* Updates the person details
* @param personId The identifier of a person
* @param details The person details
* @param opts Optional parameters
* @returns Updated person model
*/
updatePerson(personId: string, details: PersonBodyUpdate, opts?: any): Observable<EcmUserModel> {
return from(this.peopleApi.updatePerson(personId, details, opts)).pipe(
map((res: PersonEntry) => <EcmUserModel> res?.entry),
catchError((error) => this.handleError(error))
);
}
async isContentAdmin(): Promise<boolean> {
if (!this.hasCheckedIsContentAdmin) {
const user: PersonEntry = await this.getCurrentPerson().toPromise();