Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [AAE-5953] solved rebase conflict :wq * [AAE-5953] solved rebase conflict * [AAE-5953] added form cloud service interface * [AAE-5953] fixed lint errors * [AAE-5953] migrated stories and mocks * [AAE-5953] migrated task cloud service mock * [AAE-5953] migrated task cloud service mock * [AAE-5953] removed redundant mock * [AAE-5953] refactored and moved mocks * [AAE-5953] refactor modules import * [AAE-5960] added stories file and service mock * [AAE-5960] fixed validation mock * [AAE-5960] added story for user role * [AAE-5960] removed uunused properties from primary story * [AAE-5960] added interface to mock and live identity user service * [AAE-5960] added mandatory preselected users story * [AAE-5960] syntax improvements * [AAE-5960] fixed default value for roles control * [AAE-5960] refactored imports * [AAE-5960] improve syntax * [AAE-5960] refactored services name * [AAE-5960] removed deprecated argTypes defaultValue * [AAE-5960] exported new interface from core * [AAE-5960] fixed import issue with identity user mock service in core * [AAE-5960] fixed issue with viewer component test
- Loading branch information
Showing
14 changed files
with
486 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/*! | ||
* @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'; | ||
import { Observable } from 'rxjs'; | ||
import { IdentityGroupModel } from '../models/identity-group.model'; | ||
import { IdentityRoleModel } from '../models/identity-role.model'; | ||
import { IdentityUserModel } from '../models/identity-user.model'; | ||
|
||
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; | ||
} | ||
|
||
export interface IdentityUserServiceInterface { | ||
getCurrentUserInfo(): IdentityUserModel; | ||
findUsersByName(search: string): Observable<IdentityUserModel[]>; | ||
findUserByUsername(username: string): Observable<IdentityUserModel[]>; | ||
findUserByEmail(email: string): Observable<IdentityUserModel[]>; | ||
getClientRoles(userId: string, clientId: string): Observable<any[]>; | ||
checkUserHasClientApp(userId: string, clientId: string): Observable<boolean>; | ||
checkUserHasAnyClientAppRole(userId: string, clientId: string, roleNames: string[]): Observable<boolean>; | ||
getClientIdByApplicationName(applicationName: string): Observable<string>; | ||
checkUserHasApplicationAccess(userId: string, applicationName: string): Observable<boolean>; | ||
checkUserHasAnyApplicationRole(userId: string, applicationName: string, roleNames: string[]): Observable<boolean>; | ||
getUsers(): Observable<IdentityUserModel[]>; | ||
getUserRoles(userId: string): Observable<IdentityRoleModel[]>; | ||
getUsersByRolesWithCurrentUser(roleNames: string[]): Promise<IdentityUserModel[]>; | ||
getUsersByRolesWithoutCurrentUser(roleNames: string[]): Promise<IdentityUserModel[]>; | ||
checkUserHasRole(userId: string, roleNames: string[]): Observable<boolean>; | ||
queryUsers(requestQuery: IdentityUserQueryCloudRequestModel): Observable<IdentityUserQueryResponse>; | ||
getTotalUsersCount(): Observable<number>; | ||
createUser(newUser: IdentityUserModel): Observable<any>; | ||
updateUser(userId: string, updatedUser: IdentityUserModel): Observable<any>; | ||
deleteUser(userId: string): Observable<any>; | ||
changePassword(userId: string, newPassword: IdentityUserPasswordModel): Observable<any>; | ||
getInvolvedGroups(userId: string): Observable<IdentityGroupModel[]>; | ||
joinGroup(joinGroupRequest: IdentityJoinGroupRequestModel): Observable<any>; | ||
leaveGroup(userId: any, groupId: string): Observable<any>; | ||
getAvailableRoles(userId: string): Observable<IdentityRoleModel[]>; | ||
getAssignedRoles(userId: string): Observable<IdentityRoleModel[]>; | ||
getEffectiveRoles(userId: string): Observable<IdentityRoleModel[]>; | ||
assignRoles(userId: string, roles: IdentityRoleModel[]): Observable<any>; | ||
removeRoles(userId: string, removedRoles: IdentityRoleModel[]): Observable<any>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
lib/process-services-cloud/src/lib/people/components/people-cloud.component.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/*! | ||
* @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 { Meta, moduleMetadata, Story } from '@storybook/angular'; | ||
import { IdentityUserService } from '@alfresco/adf-core'; | ||
import { PeopleCloudComponent } from './people-cloud.component'; | ||
import { PeopleCloudModule } from '../people-cloud.module'; | ||
import { IdentityUserServiceMock } from '../mock/identity-user.service.mock'; | ||
import { mockUsers } from '../mock/user-cloud.mock'; | ||
import { ProcessServicesCloudStoryModule } from '../../testing/process-services-cloud-story.module'; | ||
|
||
export default { | ||
component: PeopleCloudComponent, | ||
title: 'Process Services Cloud/Components/People', | ||
decorators: [ | ||
moduleMetadata({ | ||
imports: [ProcessServicesCloudStoryModule, PeopleCloudModule], | ||
providers: [ | ||
{ provide: IdentityUserService, useClass: IdentityUserServiceMock } | ||
] | ||
}) | ||
], | ||
argTypes: { | ||
appName: { table: { disable: true } }, | ||
mode: { | ||
options: ['single', 'multiple'], | ||
control: 'radio' | ||
}, | ||
roles: { | ||
options: ['empty', 'user', 'admin'], | ||
control: 'radio', | ||
mapping: { | ||
empty: [], | ||
user: ['MOCK-USER-ROLE'], | ||
admin: ['MOCK-ADMIN-ROLE'] | ||
} | ||
} | ||
} | ||
} as Meta; | ||
|
||
const template: Story<PeopleCloudComponent> = (args: PeopleCloudComponent) => ({ | ||
props: args | ||
}); | ||
|
||
export const primary = template.bind({}); | ||
primary.args = { | ||
appName: 'app', | ||
excludedUsers: [], | ||
mode: 'single', | ||
preSelectUsers: [], | ||
readOnly: false, | ||
roles: [], | ||
title: 'Users', | ||
validate: false | ||
}; | ||
|
||
export const validPreselectedUsers = template.bind({}); | ||
validPreselectedUsers.args = { | ||
...primary.args, | ||
validate: true, | ||
mode: 'multiple', | ||
preSelectUsers: mockUsers | ||
}; | ||
|
||
export const mandatoryPreselectedUsers = template.bind({}); | ||
mandatoryPreselectedUsers.args = { | ||
...primary.args, | ||
validate: true, | ||
mode: 'multiple', | ||
preSelectUsers: [{ id: 'fake-id-1', username: 'first-name-1 last-name-1', firstName: 'first-name-1', lastName: 'last-name-1', email: 'abc@xyz.com', readonly: true }, | ||
{ id: 'fake-id-2', username: 'first-name-2 last-name-2', firstName: 'first-name-2', lastName: 'last-name-2', email: 'abcd@xyz.com' }] | ||
}; | ||
|
||
export const invalidPreselectedUsers = template.bind({}); | ||
invalidPreselectedUsers.args = { | ||
...primary.args, | ||
validate: true, | ||
mode: 'multiple', | ||
preSelectUsers: [{ id: 'invalid-user', username: 'invalid user', firstName: 'invalid', lastName: 'user', email: 'invalid@xyz.com' }] | ||
}; | ||
|
||
export const excludedUsers = template.bind({}); | ||
excludedUsers.args = { | ||
...primary.args, | ||
excludedUsers: [ | ||
{ id: 'fake-id-2' }, | ||
{ id: 'fake-id-3' } | ||
] | ||
}; | ||
|
||
export const adminRoleUser = template.bind({}); | ||
adminRoleUser.args = { | ||
...primary.args, | ||
roles: 'admin' | ||
}; | ||
|
||
export const noUsers = template.bind({}); | ||
noUsers.args = { | ||
...primary.args, | ||
excludedUsers: mockUsers | ||
}; | ||
|
||
export const invalidOrEmptyAppName = template.bind({}); | ||
invalidOrEmptyAppName.args = { | ||
...primary.args, | ||
appName: null | ||
}; |
Oops, something went wrong.