diff --git a/docs/core/services/identity-role.service.md b/docs/core/services/identity-role.service.md new file mode 100644 index 0000000000..ee06820863 --- /dev/null +++ b/docs/core/services/identity-role.service.md @@ -0,0 +1,10 @@ +--- +Title: Identity role service +Added: v3.5.0 +Status: Active +Last reviewed: 2019-09-24 +--- + +# [Identity role service](../../../lib/core/userinfo/services/identity-role.service.ts "Defined in identity-role.service.ts") + +Provides APIs for working with the Roles in Identity Services. diff --git a/lib/core/comments/comment-list.component.spec.ts b/lib/core/comments/comment-list.component.spec.ts index fb80ec4475..0118c699c7 100644 --- a/lib/core/comments/comment-list.component.spec.ts +++ b/lib/core/comments/comment-list.component.spec.ts @@ -20,7 +20,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CommentModel, UserProcessModel } from '../models'; import { CommentListComponent } from './comment-list.component'; import { By } from '@angular/platform-browser'; -import { EcmUserService } from '../userinfo/services/ecm-user.service'; +import { EcmUserService } from '../services/ecm-user.service'; import { PeopleProcessService } from '../services/people-process.service'; import { setupTestBed } from '../testing/setupTestBed'; import { CoreTestingModule } from '../testing/core.testing.module'; diff --git a/lib/core/comments/comment-list.component.ts b/lib/core/comments/comment-list.component.ts index 7541964175..3adc575eec 100644 --- a/lib/core/comments/comment-list.component.ts +++ b/lib/core/comments/comment-list.component.ts @@ -17,7 +17,7 @@ import { Component, EventEmitter, Input, Output, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core'; import { CommentModel } from '../models/comment.model'; -import { EcmUserService } from '../userinfo/services/ecm-user.service'; +import { EcmUserService } from '../services/ecm-user.service'; import { PeopleProcessService } from '../services/people-process.service'; import { UserPreferencesService, UserPreferenceValues } from '../services/user-preferences.service'; import { Subject } from 'rxjs'; diff --git a/lib/core/mock/identity-group.service.mock.ts b/lib/core/mock/identity-group.service.mock.ts index abad96d7af..94e346339d 100644 --- a/lib/core/mock/identity-group.service.mock.ts +++ b/lib/core/mock/identity-group.service.mock.ts @@ -15,8 +15,8 @@ * limitations under the License. */ -import { IdentityGroupModel, IdentityGroupCountModel } from '../userinfo/models/identity-group.model'; -import { IdentityRoleModel } from '../userinfo/models/identity-role.model'; +import { IdentityGroupModel, IdentityGroupCountModel } from '../models/identity-group.model'; +import { IdentityRoleModel } from '../models/identity-role.model'; export let mockIdentityGroup1 = new IdentityGroupModel({ id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] diff --git a/lib/core/mock/identity-user.service.mock.ts b/lib/core/mock/identity-user.service.mock.ts index 6a40719bcc..e5f05e4cc7 100644 --- a/lib/core/mock/identity-user.service.mock.ts +++ b/lib/core/mock/identity-user.service.mock.ts @@ -15,31 +15,18 @@ * limitations under the License. */ -import { IdentityUserModel, IdentityJoinGroupRequestModel } from './../userinfo/models/identity-user.model'; -import { IdentityRoleModel } from './../userinfo/models/identity-role.model'; -import { IdentityGroupModel } from './../userinfo/models/identity-group.model'; +import { IdentityUserModel } from '../models/identity-user.model'; +import { IdentityRoleModel } from '../models/identity-role.model'; +import { IdentityGroupModel } from '../models/identity-group.model'; +import { IdentityJoinGroupRequestModel } from '../services/identity-user.service'; -export let mockIdentityUser1 = new IdentityUserModel( - { id: 'mock-user-id-1', username: 'userName1', firstName: 'first-name-1', lastName: 'last-name-1', email: 'abc@xyz.com' } -); +export const mockIdentityUser1: IdentityUserModel = { id: 'mock-user-id-1', username: 'userName1', firstName: 'first-name-1', lastName: 'last-name-1', email: 'abc@xyz.com' }; +export const mockIdentityUser2: IdentityUserModel = { id: 'mock-user-id-2', username: 'userName2', firstName: 'first-name-2', lastName: 'last-name-2', email: 'abcd@xyz.com'}; +export const mockIdentityUser3: IdentityUserModel = { id: 'mock-user-id-3', username: 'userName3', firstName: 'first-name-3', lastName: 'last-name-3', email: 'abcde@xyz.com' }; +export const mockIdentityUser4: IdentityUserModel = { id: 'mock-user-id-4', username: 'userName4', firstName: 'first-name-4', lastName: 'last-name-4', email: 'abcde@xyz.com' }; +export let mockIdentityUser5: IdentityUserModel = { id: 'mock-user-id-5', username: 'userName5', firstName: 'first-name-5', lastName: 'last-name-5', email: 'abcde@xyz.com' }; -export let mockIdentityUser2 = new IdentityUserModel( - { id: 'mock-user-id-2', username: 'userName2', firstName: 'first-name-2', lastName: 'last-name-2', email: 'abcd@xyz.com'} -); - -export let mockIdentityUser3 = new IdentityUserModel( - { id: 'mock-user-id-3', username: 'userName3', firstName: 'first-name-3', lastName: 'last-name-3', email: 'abcde@xyz.com' } -); - -export let mockIdentityUser4 = new IdentityUserModel( - { id: 'mock-user-id-4', username: 'userName4', firstName: 'first-name-4', lastName: 'last-name-4', email: 'abcde@xyz.com' } -); - -export let mockIdentityUser5 = new IdentityUserModel( - { id: 'mock-user-id-5', username: 'userName5', firstName: 'first-name-5', lastName: 'last-name-5', email: 'abcde@xyz.com' } -); - -export let mockIdentityUsers = [ +export const mockIdentityUsers: IdentityUserModel[] = [ mockIdentityUser1, mockIdentityUser2, mockIdentityUser3, @@ -47,43 +34,43 @@ export let mockIdentityUsers = [ mockIdentityUser5 ]; -export let mockIdentityRole = new IdentityRoleModel({ id: 'id-1', name: 'MOCK-ADMIN-ROLE'}); +export const mockIdentityRole = new IdentityRoleModel({ id: 'id-1', name: 'MOCK-ADMIN-ROLE'}); -export let mockAvailableRoles = [ +export const mockAvailableRoles = [ new IdentityRoleModel({ id: 'mock-role-id-1', name: 'MOCK-ADMIN-ROLE'}), new IdentityRoleModel({ id: 'mock-role-id-2', name: 'MOCK-USER-ROLE'}), new IdentityRoleModel({ id: 'mock-role-id-3', name: 'MOCK_MODELER-ROLE' }), new IdentityRoleModel({ id: 'mock-role-id-5', name: 'MOCK-ROLE-2'}) ]; -export let mockAssignedRoles = [ +export const mockAssignedRoles = [ new IdentityRoleModel({ id: 'mock-role-id-1', name: 'MOCK-ADMIN-ROLE'}), new IdentityRoleModel({ id: 'mock-role-id-2', name: 'MOCK_MODELER-ROLE' }), new IdentityRoleModel({ id: 'mock-role-id-3', name: 'MOCK-ROLE-1' }) ]; -export let mockEffectiveRoles = [ +export const mockEffectiveRoles = [ new IdentityRoleModel({id: 'mock-role-id-1', name: 'MOCK-ACTIVE-ADMIN-ROLE'}), new IdentityRoleModel({id: 'mock-role-id-2', name: 'MOCK-ACTIVE-USER-ROLE'}), new IdentityRoleModel({id: 'mock-role-id-3', name: 'MOCK-ROLE-1'}) ]; -export let mockJoinGroupRequest = new IdentityJoinGroupRequestModel({userId: 'mock-hser-id', groupId: 'mock-group-id', realm: 'mock-realm-name'}); +export const mockJoinGroupRequest: IdentityJoinGroupRequestModel = {userId: 'mock-hser-id', groupId: 'mock-group-id', realm: 'mock-realm-name'}; -export let mockGroup1 = new IdentityGroupModel({ +export const mockGroup1 = new IdentityGroupModel({ id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] }); -export let mockGroup2 = new IdentityGroupModel({ +export const mockGroup2 = new IdentityGroupModel({ id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: [] }); -export let mockGroups = [ +export const mockGroups = [ new IdentityGroupModel({ id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] }), new IdentityGroupModel({ id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: [] }) ]; -export let queryUsersMockApi = { +export const queryUsersMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(mockIdentityUsers); @@ -91,7 +78,7 @@ export let queryUsersMockApi = { } }; -export let createUserMockApi = { +export const createUserMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); @@ -99,7 +86,7 @@ export let createUserMockApi = { } }; -export let updateUserMockApi = { +export const updateUserMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); @@ -107,7 +94,7 @@ export let updateUserMockApi = { } }; -export let deleteUserMockApi = { +export const deleteUserMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); @@ -115,7 +102,7 @@ export let deleteUserMockApi = { } }; -export let getInvolvedGroupsMockApi = { +export const getInvolvedGroupsMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(mockGroups); @@ -123,7 +110,7 @@ export let getInvolvedGroupsMockApi = { } }; -export let joinGroupMockApi = { +export const joinGroupMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); @@ -131,7 +118,7 @@ export let joinGroupMockApi = { } }; -export let leaveGroupMockApi = { +export const leaveGroupMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); @@ -139,7 +126,7 @@ export let leaveGroupMockApi = { } }; -export let getAvailableRolesMockApi = { +export const getAvailableRolesMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(mockAvailableRoles); @@ -147,7 +134,7 @@ export let getAvailableRolesMockApi = { } }; -export let getAssignedRolesMockApi = { +export const getAssignedRolesMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(mockAssignedRoles); @@ -155,7 +142,7 @@ export let getAssignedRolesMockApi = { } }; -export let getEffectiveRolesMockApi = { +export const getEffectiveRolesMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(mockEffectiveRoles); @@ -163,7 +150,7 @@ export let getEffectiveRolesMockApi = { } }; -export let assignRolesMockApi = { +export const assignRolesMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); @@ -171,7 +158,7 @@ export let assignRolesMockApi = { } }; -export let removeRolesMockApi = { +export const removeRolesMockApi = { oauth2Auth: { callCustomApi: () => { return Promise.resolve(); diff --git a/lib/core/userinfo/models/bpm-user.model.ts b/lib/core/models/bpm-user.model.ts similarity index 100% rename from lib/core/userinfo/models/bpm-user.model.ts rename to lib/core/models/bpm-user.model.ts diff --git a/lib/core/userinfo/models/ecm-user.model.ts b/lib/core/models/ecm-user.model.ts similarity index 96% rename from lib/core/userinfo/models/ecm-user.model.ts rename to lib/core/models/ecm-user.model.ts index 1600093063..dec9382a79 100644 --- a/lib/core/userinfo/models/ecm-user.model.ts +++ b/lib/core/models/ecm-user.model.ts @@ -16,7 +16,7 @@ */ import { Person } from '@alfresco/js-api'; -import { EcmCompanyModel } from '../../models/ecm-company.model'; +import { EcmCompanyModel } from './ecm-company.model'; export class EcmUserModel implements Person { id: string; diff --git a/lib/core/userinfo/models/identity-group.model.ts b/lib/core/models/identity-group.model.ts similarity index 100% rename from lib/core/userinfo/models/identity-group.model.ts rename to lib/core/models/identity-group.model.ts diff --git a/lib/core/userinfo/models/identity-role.model.ts b/lib/core/models/identity-role.model.ts similarity index 100% rename from lib/core/userinfo/models/identity-role.model.ts rename to lib/core/models/identity-role.model.ts diff --git a/lib/core/models/identity-user.model.ts b/lib/core/models/identity-user.model.ts new file mode 100644 index 0000000000..74203c8d86 --- /dev/null +++ b/lib/core/models/identity-user.model.ts @@ -0,0 +1,27 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface IdentityUserModel { + id?: string; + firstName?: string; + lastName?: string; + email?: string; + username?: string; + createdTimestamp?: any; + emailVerified?: boolean; + enabled?: boolean; +} diff --git a/lib/core/models/public-api.ts b/lib/core/models/public-api.ts index e79a97fa5d..3343b8a2b0 100644 --- a/lib/core/models/public-api.ts +++ b/lib/core/models/public-api.ts @@ -27,3 +27,9 @@ export * from './pagination.model'; export * from './oauth-config.model'; export * from './request-pagination.model'; export * from './decimal-number.model'; +export * from './bpm-user.model'; +export * from './ecm-user.model'; +export * from './identity-group.model'; +export * from './identity-user.model'; +export * from './identity-role.model'; +export * from './identity-group.model'; diff --git a/lib/core/pipes/user-initial.pipe.ts b/lib/core/pipes/user-initial.pipe.ts index 3fb8c4fc45..414fbd08b1 100644 --- a/lib/core/pipes/user-initial.pipe.ts +++ b/lib/core/pipes/user-initial.pipe.ts @@ -18,7 +18,7 @@ import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { UserProcessModel } from '../models/user-process.model'; -import { EcmUserModel } from '../userinfo/models/ecm-user.model'; +import { EcmUserModel } from '../models/ecm-user.model'; @Pipe({ name: 'usernameInitials' @@ -37,7 +37,7 @@ export class InitialUsernamePipe implements PipeTransform { return safeHtml; } - getInitialUserName(firstName: string, lastName: string, delimiter: string) { + getInitialUserName(firstName: string, lastName: string, delimiter: string): string { firstName = (firstName ? firstName[0] : ''); lastName = (lastName ? lastName[0] : ''); return firstName + delimiter + lastName; diff --git a/lib/core/userinfo/services/bpm-user.service.spec.ts b/lib/core/services/bpm-user.service.spec.ts similarity index 91% rename from lib/core/userinfo/services/bpm-user.service.spec.ts rename to lib/core/services/bpm-user.service.spec.ts index 9a3c6c8cef..30ef108147 100644 --- a/lib/core/userinfo/services/bpm-user.service.spec.ts +++ b/lib/core/services/bpm-user.service.spec.ts @@ -18,10 +18,10 @@ import { TestBed } from '@angular/core/testing'; import { BpmUserModel } from '../models/bpm-user.model'; import { BpmUserService } from '../services/bpm-user.service'; -import { setupTestBed } from '../../testing/setupTestBed'; -import { CoreModule } from '../../core.module'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { AlfrescoApiServiceMock } from '../../mock/alfresco-api.service.mock'; +import { setupTestBed } from '../testing/setupTestBed'; +import { CoreModule } from '../core.module'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; declare let jasmine: any; diff --git a/lib/core/userinfo/services/bpm-user.service.ts b/lib/core/services/bpm-user.service.ts similarity index 94% rename from lib/core/userinfo/services/bpm-user.service.ts rename to lib/core/services/bpm-user.service.ts index 4c910da474..95d1ae3c29 100644 --- a/lib/core/userinfo/services/bpm-user.service.ts +++ b/lib/core/services/bpm-user.service.ts @@ -17,8 +17,8 @@ import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { LogService } from '../../services/log.service'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { LogService } from './log.service'; import { BpmUserModel } from '../models/bpm-user.model'; import { map, catchError } from 'rxjs/operators'; import { UserRepresentation } from '@alfresco/js-api'; diff --git a/lib/core/userinfo/services/ecm-user.service.spec.ts b/lib/core/services/ecm-user.service.spec.ts similarity index 92% rename from lib/core/userinfo/services/ecm-user.service.spec.ts rename to lib/core/services/ecm-user.service.spec.ts index cfbb052937..ed2c4bef71 100644 --- a/lib/core/userinfo/services/ecm-user.service.spec.ts +++ b/lib/core/services/ecm-user.service.spec.ts @@ -16,12 +16,12 @@ */ import { TestBed } from '@angular/core/testing'; -import { AuthenticationService, ContentService, AlfrescoApiService } from '../../services'; -import { fakeEcmUser } from '../../mock/ecm-user.service.mock'; +import { AuthenticationService, ContentService, AlfrescoApiService } from '.'; +import { fakeEcmUser } from '../mock/ecm-user.service.mock'; import { EcmUserService } from '../services/ecm-user.service'; -import { setupTestBed } from '../../testing/setupTestBed'; -import { CoreModule } from '../../core.module'; -import { AlfrescoApiServiceMock } from '../../mock/alfresco-api.service.mock'; +import { setupTestBed } from '../testing/setupTestBed'; +import { CoreModule } from '../core.module'; +import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; declare let jasmine: any; diff --git a/lib/core/userinfo/services/ecm-user.service.ts b/lib/core/services/ecm-user.service.ts similarity index 92% rename from lib/core/userinfo/services/ecm-user.service.ts rename to lib/core/services/ecm-user.service.ts index 6b211bf830..cda8839794 100644 --- a/lib/core/userinfo/services/ecm-user.service.ts +++ b/lib/core/services/ecm-user.service.ts @@ -18,9 +18,9 @@ import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; -import { ContentService } from '../../services/content.service'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { LogService } from '../../services/log.service'; +import { ContentService } from './content.service'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { LogService } from './log.service'; import { EcmUserModel } from '../models/ecm-user.model'; import { PersonEntry } from '@alfresco/js-api'; diff --git a/lib/core/userinfo/services/identity-group.service.spec.ts b/lib/core/services/identity-group.service.spec.ts similarity index 99% rename from lib/core/userinfo/services/identity-group.service.spec.ts rename to lib/core/services/identity-group.service.spec.ts index 30e2571ae5..b7b54b5171 100644 --- a/lib/core/userinfo/services/identity-group.service.spec.ts +++ b/lib/core/services/identity-group.service.spec.ts @@ -44,7 +44,7 @@ import { updateGroupMappingApi, deleteGroupMappingApi, mockIdentityGroupsCount -} from '../../mock/identity-group.service.mock'; +} from '../mock/identity-group.service.mock'; describe('IdentityGroupService', () => { let service: IdentityGroupService; diff --git a/lib/core/userinfo/services/identity-group.service.ts b/lib/core/services/identity-group.service.ts similarity index 98% rename from lib/core/userinfo/services/identity-group.service.ts rename to lib/core/services/identity-group.service.ts index 11151c263a..239386f86a 100644 --- a/lib/core/userinfo/services/identity-group.service.ts +++ b/lib/core/services/identity-group.service.ts @@ -18,9 +18,9 @@ import { Injectable } from '@angular/core'; import { Observable, of, from, throwError } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs/operators'; -import { AppConfigService } from '../../app-config/app-config.service'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { LogService } from '../../services/log.service'; +import { AppConfigService } from '../app-config/app-config.service'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { LogService } from './log.service'; import { IdentityGroupSearchParam, IdentityGroupQueryCloudRequestModel, diff --git a/lib/core/services/identity-role.service.spec.ts b/lib/core/services/identity-role.service.spec.ts new file mode 100644 index 0000000000..2fe247f8c3 --- /dev/null +++ b/lib/core/services/identity-role.service.spec.ts @@ -0,0 +1,140 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { setupTestBed } from '@alfresco/adf-core'; +import { HttpClientModule, HttpErrorResponse, HttpResponse } from '@angular/common/http'; +import { TestBed } from '@angular/core/testing'; +import { of, throwError } from 'rxjs'; +import { IdentityRoleResponseModel, IdentityRoleService } from './identity-role.service'; + +export let mockIdentityRole1 = { + id: 'mock-id-1', name: 'Mock_Role_1', description: 'Mock desc1', clientRole: true, composite: false +}; + +export let mockIdentityRole2 = { + id: 'mock-id-2', name: 'Mock_Role_2', description: 'Mock desc2', clientRole: false, composite: true +}; + +export let mockIdentityRole3 = { + id: 'mock-id-3', name: 'Mock_Role_3', description: 'Mock desc3', clientRole: false, composite: false +}; + +export let mockIdentityRoles = { + entries: [ + mockIdentityRole1, mockIdentityRole2, mockIdentityRole3 + ], + pagination: { + skipCount: 1, + maxItems: 5, + count: 100, + hasMoreItems: false, + totalItems: 100 + } +}; + +describe('IdentityRoleService', () => { + let service: IdentityRoleService; + + setupTestBed({ + imports: [ + HttpClientModule + ] + }); + + beforeEach(() => { + service = TestBed.get(IdentityRoleService); + }); + + it('Should fetch roles', () => { + spyOn(service, 'getRoles').and.returnValue(of(mockIdentityRoles)); + service.getRoles().subscribe((response: IdentityRoleResponseModel) => { + expect(response).toBeDefined(); + + expect(response.entries[0]).toEqual(mockIdentityRole1); + expect(response.entries[1]).toEqual(mockIdentityRole2); + expect(response.entries[2]).toEqual(mockIdentityRole3); + }); + }); + + it('should be able to add role', (done) => { + const response = new HttpResponse({ + body: [], + 'status': 201, + 'statusText': 'Created' + }); + spyOn(service, 'addRole').and.returnValue(of(response)); + service.addRole(mockIdentityRole1).subscribe( + (res: any) => { + expect(res).toBeDefined(); + expect(res.status).toEqual(201); + expect(res.statusText).toEqual('Created'); + done(); + } + ); + }); + + it('Should not add role if error occurred', () => { + const errorResponse = new HttpErrorResponse({ + error: 'test 404 error', + status: 404, statusText: 'Not Found' + }); + spyOn(service, 'addRole').and.returnValue(throwError(errorResponse)); + service.addRole(mockIdentityRole1) + .subscribe( + () => fail('expected an error'), + (error) => { + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('test 404 error'); + } + ); + }); + + it('should be able to delete role', (done) => { + const response = new HttpResponse({ + body: [], + 'status': 204, + 'statusText': 'No Content' + }); + spyOn(service, 'deleteRole').and.returnValue(of(response)); + service.deleteRole(mockIdentityRole1).subscribe( + (res: any) => { + expect(res).toBeDefined(); + expect(res.status).toEqual(204); + expect(res.statusText).toEqual('No Content'); + done(); + } + ); + }); + + it('Should not delete role if error occurred', () => { + const errorResponse = new HttpErrorResponse({ + error: 'test 404 error', + status: 404, statusText: 'Not Found' + }); + spyOn(service, 'deleteRole').and.returnValue(throwError(errorResponse)); + service.deleteRole(mockIdentityRole1) + .subscribe( + () => fail('expected an error'), + (error) => { + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('test 404 error'); + } + ); + }); +}); diff --git a/lib/core/services/identity-role.service.ts b/lib/core/services/identity-role.service.ts new file mode 100644 index 0000000000..0ad79fb45c --- /dev/null +++ b/lib/core/services/identity-role.service.ts @@ -0,0 +1,128 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { throwError as observableThrowError, Observable } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import { Pagination } from '@alfresco/js-api'; +import { IdentityRoleModel } from '../models/identity-role.model'; +import { AppConfigService } from '../app-config/app-config.service'; +import { LogService } from './log.service'; + +export interface IdentityRoleResponseModel { + entries: IdentityRoleModel[]; + pagination: Pagination; + } + +@Injectable({ + providedIn: 'root' +}) +export class IdentityRoleService { + contextRoot = ''; + identityHost = ''; + + constructor( + protected http: HttpClient, + protected appConfig: AppConfigService, + protected logService: LogService + ) { + this.contextRoot = this.appConfig.get('apiHost', ''); + this.identityHost = this.appConfig.get('identityHost'); + } + + /** + * Ret all roles + * @returns List of roles + */ + getRoles( + skipCount: number = 0, + size: number = 5 + ): Observable { + return this.http.get(`${this.identityHost}/roles`).pipe( + map(res => { + return this.preparePaginationWithRoles(res, skipCount, size); + }), + catchError(error => this.handleError(error)) + ); + } + + private preparePaginationWithRoles( + roles: IdentityRoleModel[], + skipCount: number = 0, + size: number = 5 + ): IdentityRoleResponseModel { + return { + entries: roles.slice(skipCount, skipCount + size), + pagination: { + skipCount: skipCount, + maxItems: size, + count: roles.length, + hasMoreItems: false, + totalItems: roles.length + } + }; + } + + /** + * Add new role + * @param newRole Role model + * @returns Server result payload + */ + addRole(newRole: IdentityRoleModel): Observable { + if (newRole) { + const request = newRole; + return this.http + .post(`${this.identityHost}/roles`, request) + .pipe(catchError(error => this.handleError(error))); + } + } + + /** + * Delete existing role + * @param deletedRole Role model + * @returns Server result payload + */ + deleteRole(deletedRole: IdentityRoleModel): Observable { + return this.http + .delete(`${this.identityHost}/roles-by-id/${deletedRole.id}`) + .pipe(catchError(error => this.handleError(error))); + } + + /** + * Update existing role + * @param updatedRole Role model + * @param roleId Role id + * @returns Server result payload + */ + updateRole( + updatedRole: IdentityRoleModel, + roleId: string + ): Observable { + if (updatedRole && roleId) { + const request = updatedRole; + return this.http + .put(`${this.identityHost}/roles-by-id/${roleId}`, request) + .pipe(catchError(error => this.handleError(error))); + } + } + + private handleError(error: any) { + this.logService.error(error); + return observableThrowError(error || 'Server error'); + } +} diff --git a/lib/core/userinfo/services/identity-user.service.spec.ts b/lib/core/services/identity-user.service.spec.ts similarity index 97% rename from lib/core/userinfo/services/identity-user.service.spec.ts rename to lib/core/services/identity-user.service.spec.ts index 21bd027068..257c272415 100644 --- a/lib/core/userinfo/services/identity-user.service.spec.ts +++ b/lib/core/services/identity-user.service.spec.ts @@ -38,13 +38,12 @@ import { mockJoinGroupRequest } from 'core/mock/identity-user.service.mock'; import { IdentityUserService } from '../services/identity-user.service'; -import { setupTestBed } from '../../testing/setupTestBed'; -import { CoreModule } from '../../core.module'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { mockToken } from './../../mock/jwt-helper.service.spec'; -import { IdentityUserModel, IdentityUserQueryCloudRequestModel } from '../models/identity-user.model'; +import { setupTestBed } from '../testing/setupTestBed'; +import { CoreModule } from '../core.module'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { mockToken } from '../mock/jwt-helper.service.spec'; import { IdentityRoleModel } from '../models/identity-role.model'; -import { AlfrescoApiServiceMock } from '../../mock/alfresco-api.service.mock'; +import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; describe('IdentityUserService', () => { @@ -97,7 +96,7 @@ describe('IdentityUserService', () => { it('should fetch users ', (done) => { spyOn(service, 'getUsers').and.returnValue(of(mockIdentityUsers)); service.getUsers().subscribe( - (res: IdentityUserModel[]) => { + res => { expect(res).toBeDefined(); expect(res[0].id).toEqual('mock-user-id-1'); expect(res[0].username).toEqual('userName1'); @@ -171,7 +170,7 @@ describe('IdentityUserService', () => { spyOn(service, 'getUserRoles').and.returnValue(of(mockRoles)); service.getUsersByRolesWithCurrentUser([mockRoles[0].name]).then( - (res: IdentityUserModel[]) => { + res => { expect(res).toBeDefined(); expect(res[0].id).toEqual('mock-user-id-1'); expect(res[0].username).toEqual('userName1'); @@ -209,7 +208,7 @@ describe('IdentityUserService', () => { spyOn(service, 'getCurrentUserInfo').and.returnValue(mockIdentityUsers[0]); service.getUsersByRolesWithoutCurrentUser([mockRoles[0].name]).then( - (res: IdentityUserModel[]) => { + res => { expect(res).toBeDefined(); expect(res[0].id).toEqual('mock-user-id-2'); expect(res[0].username).toEqual('userName2'); @@ -292,7 +291,7 @@ describe('IdentityUserService', () => { it('should be able to query users based on query params (first & max params)', (done) => { spyOn(alfrescoApiService, 'getInstance').and.returnValue(queryUsersMockApi); - service.queryUsers(new IdentityUserQueryCloudRequestModel({first: 0, max: 5})).subscribe((res) => { + service.queryUsers({first: 0, max: 5}).subscribe((res) => { expect(res).toBeDefined(); expect(res).not.toBeNull(); expect(res.entries.length).toBe(5); @@ -314,7 +313,7 @@ describe('IdentityUserService', () => { spyOn(service, 'queryUsers').and.returnValue(throwError(errorResponse)); - service.queryUsers(new IdentityUserQueryCloudRequestModel({first: 0, max: 5})) + service.queryUsers({first: 0, max: 5}) .subscribe( () => { fail('expected an error, not users'); diff --git a/lib/core/userinfo/services/identity-user.service.ts b/lib/core/services/identity-user.service.ts similarity index 96% rename from lib/core/userinfo/services/identity-user.service.ts rename to lib/core/services/identity-user.service.ts index c64511163b..519175178d 100644 --- a/lib/core/userinfo/services/identity-user.service.ts +++ b/lib/core/services/identity-user.service.ts @@ -15,23 +15,40 @@ * limitations under the License. */ +import { Pagination } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; -import { Observable, of, from, throwError } from 'rxjs'; +import { from, Observable, of, throwError } from 'rxjs'; import { catchError, map, switchMap } from 'rxjs/operators'; - -import { - IdentityUserModel, - IdentityUserQueryResponse, - IdentityUserQueryCloudRequestModel, - IdentityUserPasswordModel, - IdentityJoinGroupRequestModel -} from '../models/identity-user.model'; -import { JwtHelperService } from '../../services/jwt-helper.service'; -import { LogService } from '../../services/log.service'; -import { AppConfigService } from '../../app-config/app-config.service'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { IdentityRoleModel } from '../models/identity-role.model'; +import { AppConfigService } from '../app-config/app-config.service'; import { IdentityGroupModel } from '../models/identity-group.model'; +import { IdentityRoleModel } from '../models/identity-role.model'; +import { IdentityUserModel } from '../models/identity-user.model'; +import { AlfrescoApiService } from './alfresco-api.service'; +import { JwtHelperService } from './jwt-helper.service'; +import { LogService } from './log.service'; + +export interface IdentityUserQueryResponse { + + entries: IdentityUserModel[]; + pagination: Pagination; +} + +export interface IdentityUserPasswordModel { + type?: string; + value?: string; + temporary?: boolean; +} + +export interface IdentityUserQueryCloudRequestModel { + first: number; + max: number; +} + +export interface IdentityJoinGroupRequestModel { + realm: string; + userId: string; + groupId: string; +} @Injectable({ providedIn: 'root' @@ -53,8 +70,7 @@ export class IdentityUserService { const givenName = this.jwtHelperService.getValueFromLocalAccessToken(JwtHelperService.GIVEN_NAME); const email = this.jwtHelperService.getValueFromLocalAccessToken(JwtHelperService.USER_EMAIL); const username = this.jwtHelperService.getValueFromLocalAccessToken(JwtHelperService.USER_PREFERRED_USERNAME); - const user = { firstName: givenName, lastName: familyName, email: email, username: username }; - return new IdentityUserModel(user); + return { firstName: givenName, lastName: familyName, email: email, username: username }; } /** diff --git a/lib/core/services/public-api.ts b/lib/core/services/public-api.ts index 423bee6f94..edcde89b34 100644 --- a/lib/core/services/public-api.ts +++ b/lib/core/services/public-api.ts @@ -56,3 +56,8 @@ export * from './lock.service'; export * from './automation.service'; export * from './automation.service'; export * from './download.service'; +export * from './bpm-user.service'; +export * from './ecm-user.service'; +export * from './identity-user.service'; +export * from './identity-group.service'; +export * from './identity-role.service'; diff --git a/lib/core/userinfo/components/user-info.component.spec.ts b/lib/core/userinfo/components/user-info.component.spec.ts index 47f21f57b5..9ac803969d 100644 --- a/lib/core/userinfo/components/user-info.component.spec.ts +++ b/lib/core/userinfo/components/user-info.component.spec.ts @@ -21,16 +21,15 @@ import { AuthenticationService, ContentService } from '../../services'; import { InitialUsernamePipe } from '../../pipes'; import { fakeBpmUser } from '../../mock/bpm-user.service.mock'; import { fakeEcmEditedUser, fakeEcmUser, fakeEcmUserNoImage } from '../../mock/ecm-user.service.mock'; -import { BpmUserService } from '../services/bpm-user.service'; -import { EcmUserService } from '../services/ecm-user.service'; -import { IdentityUserService } from '../services/identity-user.service'; -import { BpmUserModel } from './../models/bpm-user.model'; -import { EcmUserModel } from './../models/ecm-user.model'; +import { BpmUserService } from '../../services/bpm-user.service'; +import { EcmUserService } from '../../services/ecm-user.service'; +import { IdentityUserService } from '../../services/identity-user.service'; +import { BpmUserModel } from '../../models/bpm-user.model'; +import { EcmUserModel } from '../../models/ecm-user.model'; import { UserInfoComponent } from './user-info.component'; import { of } from 'rxjs'; import { setupTestBed } from '../../testing/setupTestBed'; import { CoreTestingModule } from '../../testing/core.testing.module'; -import { IdentityUserModel } from '../models/identity-user.model'; class FakeSanitizer extends DomSanitizer { @@ -556,7 +555,7 @@ describe('User info component', () => { fixture.detectChanges(); fixture.whenStable().then(() => { - component.identityUser$.subscribe((response: IdentityUserModel) => { + component.identityUser$.subscribe(response => { expect(response).toBeDefined(); expect(response.firstName).toBe('fake-identity-first-name'); expect(response.lastName).toBe('fake-identity-last-name'); @@ -583,8 +582,7 @@ describe('User info component', () => { it('should show last name if first name is null', async(() => { fixture.detectChanges(); - const fakeIdentityUser: IdentityUserModel = new IdentityUserModel(identityUserWithOutFirstNameMock); - getCurrentUserInfoStub.and.returnValue(fakeIdentityUser); + getCurrentUserInfoStub.and.returnValue(identityUserWithOutFirstNameMock); fixture.detectChanges(); fixture.whenStable().then(() => { @@ -598,8 +596,7 @@ describe('User info component', () => { })); it('should not show first name if it is null string', async(() => { - const fakeIdentityUser: IdentityUserModel = new IdentityUserModel(identityUserWithOutFirstNameMock); - getCurrentUserInfoStub.and.returnValue(of(fakeIdentityUser)); + getCurrentUserInfoStub.and.returnValue(of(identityUserWithOutFirstNameMock)); fixture.detectChanges(); fixture.whenStable().then(() => { @@ -613,8 +610,7 @@ describe('User info component', () => { })); it('should not show last name if it is null string', async(() => { - const fakeIdentityUser: IdentityUserModel = new IdentityUserModel(identityUserWithOutLastNameMock); - getCurrentUserInfoStub.and.returnValue(of(fakeIdentityUser)); + getCurrentUserInfoStub.and.returnValue(of(identityUserWithOutLastNameMock)); fixture.detectChanges(); fixture.whenStable().then(() => { diff --git a/lib/core/userinfo/components/user-info.component.ts b/lib/core/userinfo/components/user-info.component.ts index 9f2ba8c2bb..70f63de659 100644 --- a/lib/core/userinfo/components/user-info.component.ts +++ b/lib/core/userinfo/components/user-info.component.ts @@ -17,12 +17,12 @@ import { Component, Input, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; import { AuthenticationService } from '../../services/authentication.service'; -import { BpmUserModel } from './../models/bpm-user.model'; -import { EcmUserModel } from './../models/ecm-user.model'; -import { IdentityUserModel } from './../models/identity-user.model'; -import { BpmUserService } from './../services/bpm-user.service'; -import { EcmUserService } from './../services/ecm-user.service'; -import { IdentityUserService } from '../services/identity-user.service'; +import { BpmUserModel } from '../../models/bpm-user.model'; +import { EcmUserModel } from '../../models/ecm-user.model'; +import { IdentityUserModel } from '../../models/identity-user.model'; +import { BpmUserService } from '../../services/bpm-user.service'; +import { EcmUserService } from '../../services/ecm-user.service'; +import { IdentityUserService } from '../../services/identity-user.service'; import { of, Observable } from 'rxjs'; import { MatMenuTrigger } from '@angular/material'; diff --git a/lib/core/userinfo/models/identity-user.model.ts b/lib/core/userinfo/models/identity-user.model.ts deleted file mode 100644 index 9c3285ed6d..0000000000 --- a/lib/core/userinfo/models/identity-user.model.ts +++ /dev/null @@ -1,91 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Pagination } from '@alfresco/js-api'; - -export class IdentityUserModel { - id: string; - firstName: string; - lastName: string; - email: string; - username: string; - createdTimestamp?: any; - emailVerified?: boolean; - enabled?: boolean; - - constructor(obj?: any) { - if (obj) { - this.id = obj.id || null; - this.firstName = obj.firstName || null; - this.lastName = obj.lastName || null; - this.email = obj.email || null; - this.username = obj.username || null; - this.createdTimestamp = obj.createdTimestamp || null; - this.emailVerified = obj.emailVerified || null; - this.enabled = obj.enabled || null; - } - } -} - -export class IdentityUserPasswordModel { - - type: string; - value: string; - temporary: boolean; - - constructor(obj?: any) { - if (obj) { - this.type = obj.type; - this.value = obj.value; - this.temporary = obj.temporary; - } - } -} - -export interface IdentityUserQueryResponse { - - entries: IdentityUserModel[]; - pagination: Pagination; -} - -export class IdentityUserQueryCloudRequestModel { - - first: number; - max: number; - - constructor(obj?: any) { - if (obj) { - this.first = obj.first; - this.max = obj.max; - } - } -} - -export class IdentityJoinGroupRequestModel { - - realm: string; - userId: string; - groupId: string; - - constructor(obj?: any) { - if (obj) { - this.realm = obj.realm; - this.userId = obj.userId; - this.groupId = obj.groupId; - } - } -} diff --git a/lib/core/userinfo/public-api.ts b/lib/core/userinfo/public-api.ts index 04c4893f95..7685fe3d4e 100644 --- a/lib/core/userinfo/public-api.ts +++ b/lib/core/userinfo/public-api.ts @@ -16,15 +16,4 @@ */ export * from './components/user-info.component'; -export * from './services/bpm-user.service'; -export * from './services/ecm-user.service'; -export * from './services/identity-user.service'; -export * from './services/identity-group.service'; -export * from './models/bpm-user.model'; -export * from './models/ecm-user.model'; -export * from './models/identity-group.model'; -export * from './models/identity-user.model'; -export * from './models/identity-role.model'; -export * from './models/identity-group.model'; - export * from './userinfo.module'; diff --git a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts index eb1313fae3..2dc5f98412 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { IdentityUserService, IdentityUserModel } from '@alfresco/adf-core'; +import { IdentityUserService } from '@alfresco/adf-core'; import { Injectable, Inject } from '@angular/core'; import { Observable, of, BehaviorSubject, throwError } from 'rxjs'; import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model'; @@ -226,7 +226,7 @@ export class ProcessFilterCloudService { * @returns String of process instance filters preference key */ private prepareKey(appName: string): string { - const user: IdentityUserModel = this.identityUserService.getCurrentUserInfo(); + const user = this.identityUserService.getCurrentUserInfo(); return `process-filters-${appName}-${user.username}`; } diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.spec.ts index b7e413416a..7933deaaf8 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.spec.ts @@ -17,8 +17,7 @@ import { PeopleCloudComponent } from './people-cloud.component'; import { ComponentFixture, TestBed, async, tick, fakeAsync } from '@angular/core/testing'; -import { IdentityUserService, AlfrescoApiService, - CoreModule, IdentityUserModel, setupTestBed } from '@alfresco/adf-core'; +import { IdentityUserService, AlfrescoApiService, CoreModule, setupTestBed } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { of } from 'rxjs'; import { mockUsers } from '../../mock/user-cloud.mock'; @@ -111,7 +110,7 @@ describe('PeopleCloudComponent', () => { it('should emit selectedUser if option is valid', (done) => { fixture.detectChanges(); const selectEmitSpy = spyOn(component.selectUser, 'emit'); - component.onSelect(new IdentityUserModel({ username: 'username' })); + component.onSelect({ username: 'username' }); fixture.detectChanges(); fixture.whenStable().then(() => { expect(selectEmitSpy).toHaveBeenCalled(); diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts index 7e44cef54b..2412b8cd2b 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/people-cloud/people-cloud.component.ts @@ -73,7 +73,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy { /** FormControl to search the user */ @Input() - searchUserCtrl: FormControl = new FormControl(); + searchUserCtrl = new FormControl(); /** Placeholder translation key */ @@ -82,15 +82,15 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy { /** Emitted when a user is selected. */ @Output() - selectUser: EventEmitter = new EventEmitter(); + selectUser = new EventEmitter(); /** Emitted when a selected user is removed in multi selection mode. */ @Output() - removeUser: EventEmitter = new EventEmitter(); + removeUser = new EventEmitter(); /** Emitted when an warning occurs. */ @Output() - warning: EventEmitter = new EventEmitter(); + warning = new EventEmitter(); @ViewChild('userInput') private userInput: ElementRef; @@ -214,7 +214,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy { this.logService.error(error); } const isUserValid: boolean = this.userExists(result); - return isUserValid ? new IdentityUserModel(result) : null; + return isUserValid ? result : null; }); return await Promise.all(promiseBatch); } diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts index 55763ff4a9..b8df3ed79d 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts @@ -52,7 +52,7 @@ describe('StartTaskCloudComponent', () => { } }; - const mockUser = new IdentityUserModel({username: 'currentUser', firstName: 'Test', lastName: 'User', email: 'currentUser@test.com'}); + const mockUser: IdentityUserModel = {username: 'currentUser', firstName: 'Test', lastName: 'User', email: 'currentUser@test.com'}; setupTestBed({ imports: [ProcessServiceCloudTestingModule, StartTaskCloudTestingModule], diff --git a/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts b/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts index 034dcbba52..8d00ea7661 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { IdentityUserService, IdentityUserModel } from '@alfresco/adf-core'; +import { IdentityUserService } from '@alfresco/adf-core'; import { Injectable, Inject } from '@angular/core'; import { Observable, of, BehaviorSubject, throwError } from 'rxjs'; import { TaskFilterCloudModel } from '../models/filter-cloud.model'; @@ -231,7 +231,7 @@ export class TaskFilterCloudService { * @returns Username string */ getUsername(): string { - const user: IdentityUserModel = this.identityUserService.getCurrentUserInfo(); + const user = this.identityUserService.getCurrentUserInfo(); return user.username; }