mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
7d73d772df
https://linear.app/unleash/issue/2-579/improve-user-like-behaviour-for-service-accounts-accounts-concept Builds on top of https://github.com/Unleash/unleash/pull/2917 by moving the responsibility of handling both account types from `users` to `accounts`. Ideally: - `users` - Should only handle users; - `service-accounts` - Should only handle service accounts; - `accounts` - Should handle any type of account; This should hopefully also provide a good building block in case we later decide to refactor this further down the `accounts` path.
96 lines
2.7 KiB
TypeScript
96 lines
2.7 KiB
TypeScript
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
import { AccessService } from '../../lib/services/access-service';
|
|
import User from '../../lib/types/user';
|
|
import noLoggerProvider from './no-logger';
|
|
import { IRole } from '../../lib/types/stores/access-store';
|
|
import {
|
|
IAvailablePermissions,
|
|
IRoleData,
|
|
IUserWithRole,
|
|
} from '../../lib/types/model';
|
|
import { IGroupModelWithProjectRole } from '../../lib/types/group';
|
|
|
|
class AccessServiceMock extends AccessService {
|
|
constructor() {
|
|
super(
|
|
{
|
|
accessStore: undefined,
|
|
accountStore: undefined,
|
|
roleStore: undefined,
|
|
environmentStore: undefined,
|
|
},
|
|
{ getLogger: noLoggerProvider },
|
|
undefined,
|
|
);
|
|
}
|
|
|
|
hasPermission(
|
|
user: User,
|
|
permission: string,
|
|
projectId?: string,
|
|
): Promise<boolean> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
getPermissions(): Promise<IAvailablePermissions> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
addUserToRole(userId: number, roleId: number): Promise<void> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
setUserRootRole(userId: number, roleId: number): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
addPermissionToRole(
|
|
roleId: number,
|
|
permission: string,
|
|
projectId?: string,
|
|
): Promise<void> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
removePermissionFromRole(
|
|
roleId: number,
|
|
permission: string,
|
|
projectId?: string,
|
|
): Promise<void> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
getRoles(): Promise<IRole[]> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
getRolesForProject(projectId: string): Promise<IRole[]> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
getRolesForUser(userId: number): Promise<IRole[]> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
getUsersForRole(roleId: any): Promise<User[]> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
getProjectRoleAccess(
|
|
projectId: string,
|
|
): Promise<[IRole[], IUserWithRole[], IGroupModelWithProjectRole[]]> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
createDefaultProjectRoles(owner: User, projectId: string): Promise<void> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
removeDefaultProjectRoles(owner: User, projectId: string): Promise<void> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
}
|
|
|
|
export default AccessServiceMock;
|