mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +01:00
fix: create new user
This commit is contained in:
parent
4409111be0
commit
563345695d
@ -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}`,
|
||||
|
Loading…
Reference in New Issue
Block a user