mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	chore: More minor cleanups of code
This commit is contained in:
		
							parent
							
								
									deaf614dde
								
							
						
					
					
						commit
						21560f2dac
					
				| @ -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', | ||||
|  | ||||
| @ -183,5 +183,3 @@ export default class RoleStore implements IRoleStore { | ||||
| 
 | ||||
|     destroy(): void {} | ||||
| } | ||||
| 
 | ||||
| module.exports = RoleStore; | ||||
|  | ||||
| @ -21,4 +21,3 @@ class RoleInUseError extends Error { | ||||
| } | ||||
| 
 | ||||
| export default RoleInUseError; | ||||
| module.exports = RoleInUseError; | ||||
|  | ||||
| @ -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> { | ||||
|  | ||||
| @ -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); | ||||
| }); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user