You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-04 05:50:38 +02:00
16 lines
374 B
TypeScript
16 lines
374 B
TypeScript
![]() |
import { Permission } from 'src/enum';
|
||
|
import { setIsSuperset } from 'src/utils/set';
|
||
|
|
||
|
export type GrantedRequest = {
|
||
|
requested: Permission[];
|
||
|
current: Permission[];
|
||
|
};
|
||
|
|
||
|
export const isGranted = ({ requested, current }: GrantedRequest) => {
|
||
|
if (current.includes(Permission.ALL)) {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
return setIsSuperset(new Set(current), new Set(requested));
|
||
|
};
|