fix(web): machine org permission visibility
This commit is contained in:
parent
c66de45522
commit
8190740abf
@ -11,13 +11,18 @@ import "server-only";
|
|||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
|
|
||||||
export async function getMachines() {
|
export async function getMachines() {
|
||||||
const { userId } = auth();
|
const { userId, orgId } = auth();
|
||||||
if (!userId) throw new Error("No user id");
|
if (!userId) throw new Error("No user id");
|
||||||
const machines = await db
|
const machines = await db
|
||||||
.select()
|
.select()
|
||||||
.from(machinesTable)
|
.from(machinesTable)
|
||||||
.where(
|
.where(
|
||||||
and(eq(machinesTable.user_id, userId), eq(machinesTable.disabled, false))
|
and(
|
||||||
|
orgId
|
||||||
|
? eq(machinesTable.org_id, orgId)
|
||||||
|
: eq(machinesTable.user_id, userId),
|
||||||
|
eq(machinesTable.disabled, false)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return machines;
|
return machines;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user