1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

refactor: make permission check type less demanding (#3214)

This commit is contained in:
Mateusz Kwasniewski 2023-02-28 14:48:27 +01:00 committed by GitHub
parent 99db4baae0
commit ee20737e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,7 +105,7 @@ export class AccessService {
* @param projectId
*/
async hasPermission(
user: User,
user: Pick<IUser, 'id' | 'permissions' | 'isAPI'>,
permission: string,
projectId?: string,
environment?: string,
@ -143,7 +143,9 @@ export class AccessService {
}
}
async getPermissionsForUser(user: IUser): Promise<IUserPermission[]> {
async getPermissionsForUser(
user: Pick<IUser, 'id' | 'isAPI' | 'permissions'>,
): Promise<IUserPermission[]> {
if (user.isAPI) {
return user.permissions?.map((p) => ({
permission: p,