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,
|
RoleType.ROOT,
|
||||||
);
|
);
|
||||||
|
|
||||||
const editorRole = await this.roleStore.getRoleByName(
|
|
||||||
RoleName.EDITOR,
|
|
||||||
);
|
|
||||||
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(
|
await this.store.addUserToRole(
|
||||||
userId,
|
userId,
|
||||||
newRootRole.id,
|
newRootRole.id,
|
||||||
ALL_PROJECTS,
|
ALL_PROJECTS,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not add role=${newRootRole.name} to userId=${userId}`,
|
`Could not add role=${newRootRole.name} to userId=${userId}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user