Skip to content

Commit

Permalink
refactor: make permission check type less demanding (#3214)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Feb 28, 2023
1 parent 99db4ba commit ee20737
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/services/access-service.ts
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ee20737

Please sign in to comment.