mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: make hasPermission call handle api tokens (#1041)
This commit is contained in:
		
							parent
							
								
									26407cc02e
								
							
						
					
					
						commit
						1f37b0bf4b
					
				@ -87,7 +87,7 @@ export class AccessService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const userP = await this.store.getPermissionsForUser(user.id);
 | 
					            const userP = await this.getPermissionsForUser(user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return userP
 | 
					            return userP
 | 
				
			||||||
                .filter(
 | 
					                .filter(
 | 
				
			||||||
@ -111,7 +111,9 @@ export class AccessService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    async getPermissionsForUser(user: User): Promise<IUserPermission[]> {
 | 
					    async getPermissionsForUser(user: User): Promise<IUserPermission[]> {
 | 
				
			||||||
        if (user.isAPI) {
 | 
					        if (user.isAPI) {
 | 
				
			||||||
            return [];
 | 
					            return user.permissions.map((p) => ({
 | 
				
			||||||
 | 
					                permission: p,
 | 
				
			||||||
 | 
					            }));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return this.store.getPermissionsForUser(user.id);
 | 
					        return this.store.getPermissionsForUser(user.id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user