mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01: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,
 | 
			
		||||
                    RoleType.ROOT,
 | 
			
		||||
                );
 | 
			
		||||
                await this.store.addUserToRole(
 | 
			
		||||
                    userId,
 | 
			
		||||
                    newRootRole.id,
 | 
			
		||||
                    ALL_PROJECTS,
 | 
			
		||||
 | 
			
		||||
                const editorRole = await this.store.getRoleByName(
 | 
			
		||||
                    RoleName.EDITOR,
 | 
			
		||||
                );
 | 
			
		||||
                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) {
 | 
			
		||||
                throw new Error(
 | 
			
		||||
                    `Could not add role=${newRootRole.name} to userId=${userId}`,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user