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, |                     userId, | ||||||
|                     RoleType.ROOT, |                     RoleType.ROOT, | ||||||
|                 ); |                 ); | ||||||
|  | 
 | ||||||
|  |                 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( |                     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