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:
parent
99db4baae0
commit
ee20737e4a
@ -105,7 +105,7 @@ export class AccessService {
|
|||||||
* @param projectId
|
* @param projectId
|
||||||
*/
|
*/
|
||||||
async hasPermission(
|
async hasPermission(
|
||||||
user: User,
|
user: Pick<IUser, 'id' | 'permissions' | 'isAPI'>,
|
||||||
permission: string,
|
permission: string,
|
||||||
projectId?: string,
|
projectId?: string,
|
||||||
environment?: 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) {
|
if (user.isAPI) {
|
||||||
return user.permissions?.map((p) => ({
|
return user.permissions?.map((p) => ({
|
||||||
permission: p,
|
permission: p,
|
||||||
|
Loading…
Reference in New Issue
Block a user