1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-19 00:15:43 +01:00

chore: More minor cleanups of code

This commit is contained in:
sighphyre 2022-01-06 15:00:26 +02:00 committed by Ivar Conradi Østhus
parent deaf614dde
commit 21560f2dac
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09
5 changed files with 5 additions and 38 deletions

View File

@ -14,7 +14,7 @@ import NotFoundError from '../error/notfound-error';
import {
ENVIRONMENT_PERMISSION_TYPE,
ROOT_PERMISSION_TYPE,
} from 'lib/util/constants';
} from '../util/constants';
const T = {
ROLE_USER: 'role_user',

View File

@ -183,5 +183,3 @@ export default class RoleStore implements IRoleStore {
destroy(): void {}
}
module.exports = RoleStore;

View File

@ -21,4 +21,3 @@ class RoleInUseError extends Error {
}
export default RoleInUseError;
module.exports = RoleInUseError;

View File

@ -324,11 +324,7 @@ export default class ProjectService {
}
}
await this.accessService.removeUserFromRole(
userId,
role.id,
projectId,
);
await this.accessService.removeUserFromRole(userId, role.id, projectId);
}
async getMembers(projectId: string): Promise<number> {

View File

@ -35,11 +35,7 @@ const createUserEditorAccess = async (name, email) => {
const createUserViewerAccess = async (name, email) => {
const { userStore } = stores;
const user = await userStore.insert({ name, email });
await accessService.addUserToRole(
user.id,
readRole.id,
ALL_PROJECTS,
);
await accessService.addUserToRole(user.id, readRole.id, ALL_PROJECTS);
return user;
};
@ -182,11 +178,7 @@ const createSuperUser = async () => {
name: 'Alice Admin',
email: 'admin@getunleash.io',
});
await accessService.addUserToRole(
user.id,
adminRole.id,
ALL_PROJECTS,
);
await accessService.addUserToRole(user.id, adminRole.id, ALL_PROJECTS);
return user;
};
@ -425,11 +417,7 @@ test('should remove user from role', async () => {
expect(userRoles.length).toBe(1);
expect(userRoles[0].name).toBe(RoleName.EDITOR);
await accessService.removeUserFromRole(
user.id,
editorRole.id,
'default',
);
await accessService.removeUserFromRole(user.id, editorRole.id, 'default');
const userRolesAfterRemove = await accessService.getRolesForUser(user.id);
expect(userRolesAfterRemove.length).toBe(0);
});
@ -679,17 +667,3 @@ test('Should be denied access to delete a role that is in use', async () => {
);
}
});
test('Should be given full access to project created by user', async () => {
const user = editorUser;
const newProjectName = 'AWholeNewProject';
const project = {
id: newProjectName,
name: newProjectName,
description: 'Blah',
};
await projectService.createProject(project, user.id);
hasFullProjectAccess(user, newProjectName, true);
});