mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 04:25:39 +01:00
Auth checkpoint.
This commit is contained in:
parent
0bcfc6654d
commit
3085bdd713
6 changed files with 51 additions and 91 deletions
|
|
@ -19,7 +19,7 @@ export async function getPermissions(where: Prisma.PermissionWhereInput): Promis
|
|||
});
|
||||
}
|
||||
|
||||
export async function getPermissionsByUserId(userId, name?: string): Promise<Permission[]> {
|
||||
export async function getPermissionsByUserId(userId: string, name?: string): Promise<Permission[]> {
|
||||
return prisma.client.permission.findMany({
|
||||
where: {
|
||||
...(name ? { name } : {}),
|
||||
|
|
@ -40,7 +40,11 @@ export async function getPermissionsByUserId(userId, name?: string): Promise<Per
|
|||
});
|
||||
}
|
||||
|
||||
export async function getPermissionsByTeamId(teamId, name?: string): Promise<Permission[]> {
|
||||
export async function getTeamPermissionsByUserId(
|
||||
userId: string,
|
||||
teamId: string,
|
||||
name?: string,
|
||||
): Promise<Permission[]> {
|
||||
return prisma.client.permission.findMany({
|
||||
where: {
|
||||
...(name ? { name } : {}),
|
||||
|
|
@ -50,6 +54,7 @@ export async function getPermissionsByTeamId(teamId, name?: string): Promise<Per
|
|||
is: {
|
||||
TeamUser: {
|
||||
every: {
|
||||
userId,
|
||||
teamId,
|
||||
},
|
||||
},
|
||||
|
|
@ -70,14 +75,3 @@ export async function updatePermission(
|
|||
where,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deletePermission(permissionId: string): Promise<Permission> {
|
||||
return prisma.client.permission.update({
|
||||
data: {
|
||||
isDeleted: true,
|
||||
},
|
||||
where: {
|
||||
id: permissionId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,14 +44,3 @@ export async function updateRole(
|
|||
where,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteRole(roleId: string): Promise<Role> {
|
||||
return prisma.client.role.update({
|
||||
data: {
|
||||
isDeleted: true,
|
||||
},
|
||||
where: {
|
||||
id: roleId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue