alfresco-ng2-components/lib/core/services/identity-user.service.interface.ts
tomgny a40de80658
[AAE-6389] Remove duplicated identity user service mock (#7373)
* [AAE-6389] removed duplicate services and refactored existing

* [AAE-6389] improved and moved mocks to proper files

* [AAE-6389] fixed circular dependency
2021-11-24 10:18:20 +00:00

79 lines
3.6 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;
findUserById(id: string): Observable<any>;
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>;
}