v1.6.3: fix project file upload, filter responsible user by permission
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ export interface ListUsersParams {
|
||||
sort: string;
|
||||
order: "asc" | "desc";
|
||||
search: string;
|
||||
permission?: string;
|
||||
}
|
||||
|
||||
export interface CreateUserData {
|
||||
@@ -56,10 +57,10 @@ export interface UpdateUserData {
|
||||
}
|
||||
|
||||
export async function listUsers(params: ListUsersParams) {
|
||||
const { page, limit, skip, sort, order, search } = params;
|
||||
const { page, limit, skip, sort, order, search, permission } = params;
|
||||
const sortField = ALLOWED_SORT_FIELDS.includes(sort) ? sort : "id";
|
||||
|
||||
const where = search
|
||||
let where: any = search
|
||||
? {
|
||||
OR: [
|
||||
{ username: { contains: search } },
|
||||
@@ -70,6 +71,14 @@ export async function listUsers(params: ListUsersParams) {
|
||||
}
|
||||
: {};
|
||||
|
||||
if (permission) {
|
||||
where.roles = {
|
||||
role_permissions: {
|
||||
some: { permissions: { name: permission } },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const [users, total] = await Promise.all([
|
||||
prisma.users.findMany({
|
||||
where,
|
||||
|
||||
Reference in New Issue
Block a user