mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-23 13:46:45 +02:00
fix: Add back to get permissions working for editor role
This commit is contained in:
parent
0634758784
commit
cd782be6dc
@ -152,11 +152,31 @@ export class AccessService {
|
|||||||
userId,
|
userId,
|
||||||
RoleType.ROOT,
|
RoleType.ROOT,
|
||||||
);
|
);
|
||||||
await this.store.addUserToRole(
|
|
||||||
userId,
|
const editorRole = await this.store.getRoleByName(
|
||||||
newRootRole.id,
|
RoleName.EDITOR,
|
||||||
ALL_PROJECTS,
|
|
||||||
);
|
);
|
||||||
|
if (newRootRole.id === editorRole.id) {
|
||||||
|
const viewerRole = await this.store.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) {
|
} 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