From 563345695d66b5210b942ff2a8ed7fec4517cdab Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Tue, 4 Jan 2022 11:06:51 +0100 Subject: [PATCH] fix: create new user --- src/lib/services/access-service.ts | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/lib/services/access-service.ts b/src/lib/services/access-service.ts index f9be05a6ed..049ae2c8ed 100644 --- a/src/lib/services/access-service.ts +++ b/src/lib/services/access-service.ts @@ -195,30 +195,11 @@ export class AccessService { RoleType.ROOT, ); - const editorRole = await this.roleStore.getRoleByName( - RoleName.EDITOR, + await this.store.addUserToRole( + userId, + newRootRole.id, + ALL_PROJECTS, ); - if (newRootRole.id === editorRole.id) { - const viewerRole = await this.roleStore.getRoleByName( - RoleName.VIEWER, - ); - await this.store.addUserToRole( - userId, - editorRole.id, - 'default', - ); - await this.store.addUserToRole( - userId, - viewerRole.id, - ALL_PROJECTS, - ); - } else { - await this.store.addUserToRole( - userId, - newRootRole.id, - ALL_PROJECTS, - ); - } } catch (error) { throw new Error( `Could not add role=${newRootRole.name} to userId=${userId}`,