aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Utility/authorisation.ts
blob: c6b644141bd710e42e5457732e41aab1c3772764 (plain) (blame)
1
2
3
4
5
6
7
8
9
/**
 * Whether a caller may act on resources belonging to `targetUserId`: either the
 * caller owns them, or the caller is a privileged (allow-listed) user.
 */
export const isOwnerOrPrivileged = (
	callerUserId: number,
	targetUserId: number,
	privileged: boolean,
) => privileged || callerUserId === targetUserId;