mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
[ADF-3812] Add multi selection and roles filtering to adf-cloud-people component (#4068)
* [ADF-3812] Added multiple user selection and user pre-selection * [ADF-3812] Added tests * [ADF-3812] Added jsdoc * [ADF-3812] Improved variable naming * [ADF-3812] Improved mode selection * [ADF-3812] Changed input name and emit logic * [ADF-3812] Used modified emitter name in start task * [ADF-3812] Improved default role selection * Use the new strategy to fetch the authorized users * * Fixed pre-selection in single mode * * Added invalid selection validation * * Added start task assignee validation * * Improved preset loading * * Improved tests * * Added test to validate default assignee * * Added methods to check user has access to an app * * Added app access to people cloud and start task * * Refactored methods and removed unused input - showCurrentUser * * Added tests * * Changed service names and removed unwated services * * Used formControl error instead of manual error flag * * Used new hasError method of people component inside start task * * Improved tests * * Updated callCustomApi call signature * * Added documentation * * Disabled search until clientId is retrieved * * Changed realm name * * Added jsdoc for service methods * Remove the useless doc
This commit is contained in:
committed by
Eugenio Romano
parent
46150a65f2
commit
f08ad08d0f
@@ -199,4 +199,52 @@ describe('IdentityUserService', () => {
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return true when user has access to an application', (done) => {
|
||||
spyOn(service, 'getClientIdByApplicationName').and.returnValue(of('mock-client'));
|
||||
spyOn(service, 'getClientRoles').and.returnValue(of(mockRoles));
|
||||
|
||||
service.checkUserHasClientApp('user-id', 'app-name').subscribe(
|
||||
(res: boolean) => {
|
||||
expect(res).toBeTruthy();
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return false when user does not have access to an application', (done) => {
|
||||
spyOn(service, 'getClientIdByApplicationName').and.returnValue(of('mock-client'));
|
||||
spyOn(service, 'getClientRoles').and.returnValue(of([]));
|
||||
|
||||
service.checkUserHasClientApp('user-id', 'app-name').subscribe(
|
||||
(res: boolean) => {
|
||||
expect(res).toBeFalsy();
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return true when user has any given application role', (done) => {
|
||||
spyOn(service, 'getClientIdByApplicationName').and.returnValue(of('mock-client'));
|
||||
spyOn(service, 'getClientRoles').and.returnValue(of(mockRoles));
|
||||
|
||||
service.checkUserHasAnyClientAppRole('user-id', 'app-name', [mockRoles[1].name] ).subscribe(
|
||||
(res: boolean) => {
|
||||
expect(res).toBeTruthy();
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return false when user does not have any given application role', (done) => {
|
||||
spyOn(service, 'getClientIdByApplicationName').and.returnValue(of('mock-client'));
|
||||
spyOn(service, 'getClientRoles').and.returnValue(of([]));
|
||||
|
||||
service.checkUserHasAnyClientAppRole('user-id', 'app-name', [mockRoles[1].name]).subscribe(
|
||||
(res: boolean) => {
|
||||
expect(res).toBeFalsy();
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user