alfresco-ng2-components/lib/core/services/identity-user.service.interface.ts
tomgny d3f99a74b0
[AAE-5960] Storybook stories for PeopleCloud component (#7313)
* [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
2021-10-22 15:54:56 +01:00

78 lines
3.5 KiB
TypeScript

/*!
* @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>;
}