mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 16:45:35 +01:00
Add permission checks.
This commit is contained in:
parent
51e2331315
commit
78225691df
20 changed files with 225 additions and 333 deletions
|
|
@ -19,6 +19,27 @@ export async function getPermissions(where: Prisma.PermissionWhereInput): Promis
|
|||
});
|
||||
}
|
||||
|
||||
export async function getPermissionsByUserId(userId, name?: string): Promise<Permission[]> {
|
||||
return prisma.client.permission.findMany({
|
||||
where: {
|
||||
...(name ? { name } : {}),
|
||||
RolePermission: {
|
||||
every: {
|
||||
role: {
|
||||
is: {
|
||||
userRoles: {
|
||||
every: {
|
||||
userId,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function updatePermission(
|
||||
data: Prisma.PermissionUpdateInput,
|
||||
where: Prisma.PermissionWhereUniqueInput,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue