mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-9019] - People/Group cloud with HxP (#7658)
* Cover the use cases by mocking them * Replace the mock with real stream and remove useless code * Provide new service to fetch groups * Fix group tests * Use the interface and token injection * [AAE-8870] add unit test and mock for new service * Improve roles condifion * initialize the stream as part of NgOnInit to be sure it relies on the correct FormControl instance(input) * Rollback tmp change for roles * [AAE-8641] people abstraction mock * [AAE-8641] revert angular.json changes * [AAE-8641] few conditions and code improvements * [AAE-8641] revert change input controls name * [AAE-8641] initialize the stream as part of ngOnInit * [AAE-8641] people abstraction improvements * [AAE-8870] cherry pick people abstraction * [AAE-8641] fix people-group e2es * fix lint * remove hardcoded identityHost * Use the identityhost api in case of cloud * Solve issue with returnType array string * Rebase and use GroupModel from cloud * Rebase and use GroupModel from cloud * Use the bpmHost instead of identityFor * Add identity ingress for user access service * Rename test * Fix linting issues * Fix playwright storybook e2e for people and group * Trigger travis * Fix people group e2e * improved formatting * Remove not needed travis var override * Remove unused import after rebase * Make roles in filter optional + remove comments Co-authored-by: Tomasz <tomasz.gnyp@hyland.com> Co-authored-by: arditdomi <ardit.domi@hyland.com>
This commit is contained in:
@@ -22,15 +22,27 @@ export class FullNamePipe implements PipeTransform {
|
||||
transform(user: any): string {
|
||||
let fullName = '';
|
||||
if (user) {
|
||||
if (user.firstName && user.firstName !== 'null') {
|
||||
fullName += user.firstName;
|
||||
}
|
||||
if (user.lastName && user.lastName !== 'null') {
|
||||
fullName += fullName.length > 0 ? ' ' : '';
|
||||
fullName += user.lastName;
|
||||
}
|
||||
if (!fullName) {
|
||||
fullName += user.username ? user.username : user.email ? user.email : '';
|
||||
if (user.displayName) {
|
||||
const firstAndLastName = user.displayName.split('\ (.*)');
|
||||
if (firstAndLastName[0]) {
|
||||
fullName += firstAndLastName[0];
|
||||
}
|
||||
if (firstAndLastName[1]) {
|
||||
fullName += fullName.length > 0 ? ' ' : '';
|
||||
fullName += firstAndLastName[1];
|
||||
}
|
||||
|
||||
} else {
|
||||
if (user.firstName && user.firstName !== 'null') {
|
||||
fullName += user.firstName;
|
||||
}
|
||||
if (user.lastName && user.lastName !== 'null') {
|
||||
fullName += fullName.length > 0 ? ' ' : '';
|
||||
fullName += user.lastName;
|
||||
}
|
||||
if (!fullName) {
|
||||
fullName += user.username ? user.username : user.email ? user.email : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
return fullName;
|
||||
|
@@ -131,12 +131,12 @@ describe('UserAccessService', () => {
|
||||
expect(getAccessFromApiSpy.calls.count()).toEqual(1);
|
||||
});
|
||||
|
||||
it('should the url be composed from identity host of app.config', async () => {
|
||||
it('should the url be composed from bpm host of app.config', async () => {
|
||||
const fakeIdentityHost = 'https://fake-identity-host.fake.com';
|
||||
appConfigService.config.identityHost = fakeIdentityHost;
|
||||
appConfigService.config.bpmHost = fakeIdentityHost;
|
||||
await userAccessService.fetchUserAccess();
|
||||
|
||||
expect(getAccessFromApiSpy).toHaveBeenCalledWith({ url: `${ fakeIdentityHost }/v1/identity/roles` });
|
||||
expect(getAccessFromApiSpy).toHaveBeenCalledWith({ url: `${fakeIdentityHost}/modeling-service/v1/identity/roles` });
|
||||
});
|
||||
|
||||
it('should not fetch the access from the API if is not configured with OAUTH', async () => {
|
||||
|
@@ -22,6 +22,8 @@ import { UserAccessModel } from '../models/user-access.model';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { OAuth2Service } from './oauth2.service';
|
||||
|
||||
const IDENTITY_MICRO_SERVICE_INGRESS = 'modeling-service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -50,7 +52,7 @@ export class UserAccessService {
|
||||
}
|
||||
|
||||
private async fetchAccessFromApi() {
|
||||
const url = `${ this.identityHost }/v1/identity/roles`;
|
||||
const url = `${this.identityHost}/${IDENTITY_MICRO_SERVICE_INGRESS}/v1/identity/roles`;
|
||||
await this.oAuth2Service.get({ url })
|
||||
.toPromise()
|
||||
.then((response: UserAccessModel) => {
|
||||
@@ -68,7 +70,7 @@ export class UserAccessService {
|
||||
}
|
||||
|
||||
private get identityHost(): string {
|
||||
return `${this.appConfigService.get('identityHost')}`;
|
||||
return `${this.appConfigService.get('bpmHost')}`;
|
||||
}
|
||||
|
||||
private isOauth(): boolean {
|
||||
|
Reference in New Issue
Block a user