2022-01-13 11:14:17 +01:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
|
|
import { ICustomRole } from 'lib/types/model';
|
|
|
|
import { IRole, IUserRole } from 'lib/types/stores/access-store';
|
|
|
|
import {
|
|
|
|
ICustomRoleInsert,
|
|
|
|
ICustomRoleUpdate,
|
|
|
|
IRoleStore,
|
|
|
|
} from 'lib/types/stores/role-store';
|
|
|
|
|
|
|
|
export default class FakeRoleStore implements IRoleStore {
|
2022-10-25 13:10:27 +02:00
|
|
|
count(): Promise<number> {
|
|
|
|
return Promise.resolve(0);
|
|
|
|
}
|
|
|
|
|
2022-09-14 14:29:12 +02:00
|
|
|
roles: ICustomRole[] = [];
|
|
|
|
|
2022-07-21 16:23:56 +02:00
|
|
|
getGroupRolesForProject(projectId: string): Promise<IRole[]> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
2023-03-14 16:27:57 +01:00
|
|
|
nameInUse(name: string, existingId?: number): Promise<boolean> {
|
2022-01-13 11:14:17 +01:00
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
2022-09-14 14:29:12 +02:00
|
|
|
async getAll(): Promise<ICustomRole[]> {
|
|
|
|
return this.roles;
|
2022-01-13 11:14:17 +01:00
|
|
|
}
|
|
|
|
|
2022-09-14 14:29:12 +02:00
|
|
|
async create(role: ICustomRoleInsert): Promise<ICustomRole> {
|
2022-09-30 13:01:32 +02:00
|
|
|
const roleCreated = {
|
|
|
|
...role,
|
|
|
|
type: 'some-type',
|
|
|
|
id: this.roles.length,
|
|
|
|
};
|
2022-09-14 14:29:12 +02:00
|
|
|
this.roles.push(roleCreated);
|
|
|
|
return Promise.resolve(roleCreated);
|
2022-01-13 11:14:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
update(role: ICustomRoleUpdate): Promise<ICustomRole> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
delete(id: number): Promise<void> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
getRoles(): Promise<IRole[]> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
2022-09-14 14:29:12 +02:00
|
|
|
async getRoleByName(name: string): Promise<IRole> {
|
|
|
|
return this.roles.find((r) => (r.name = name));
|
2022-01-13 11:14:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
getRolesForProject(projectId: string): Promise<IRole[]> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
removeRolesForProject(projectId: string): Promise<void> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
getProjectRoles(): Promise<IRole[]> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
2022-09-14 14:29:12 +02:00
|
|
|
async getRootRoles(): Promise<IRole[]> {
|
|
|
|
return this.roles;
|
2022-01-13 11:14:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
getRootRoleForAllUsers(): Promise<IUserRole[]> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
get(key: number): Promise<ICustomRole> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
exists(key: number): Promise<boolean> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteAll(): Promise<void> {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
|
|
|
|
destroy(): void {
|
|
|
|
throw new Error('Method not implemented.');
|
|
|
|
}
|
|
|
|
}
|