mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
29 lines
589 B
TypeScript
29 lines
589 B
TypeScript
import { Auth } from '@/lib/types';
|
|
|
|
export async function canCreateUser({ user }: Auth) {
|
|
return user.isAdmin;
|
|
}
|
|
|
|
export async function canViewUser({ user }: Auth, viewedUserId: string) {
|
|
if (user.isAdmin) {
|
|
return true;
|
|
}
|
|
|
|
return user.id === viewedUserId;
|
|
}
|
|
|
|
export async function canViewUsers({ user }: Auth) {
|
|
return user.isAdmin;
|
|
}
|
|
|
|
export async function canUpdateUser({ user }: Auth, viewedUserId: string) {
|
|
if (user.isAdmin) {
|
|
return true;
|
|
}
|
|
|
|
return user.id === viewedUserId;
|
|
}
|
|
|
|
export async function canDeleteUser({ user }: Auth) {
|
|
return user.isAdmin;
|
|
}
|