mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on role in workspace.
This commit is contained in:
+10
-6
@@ -117,14 +117,18 @@ export const {handlers, auth: baseAuth, signIn, signOut} = NextAuth({
|
||||
|
||||
const defaultOrganization = await prisma.organization.findUnique({
|
||||
where: {slug: "default"},
|
||||
include: {users: {}}
|
||||
});
|
||||
|
||||
await prisma.userOrganization.create({
|
||||
data: {
|
||||
userId: newUser.id,
|
||||
organizationId: defaultOrganization.id
|
||||
},
|
||||
});
|
||||
const organizationRole = defaultOrganization.users.length > 0 ? "member" : "admin"
|
||||
|
||||
await prisma.userOrganization.create({
|
||||
data: {
|
||||
userId: newUser.id,
|
||||
organizationId: defaultOrganization.id,
|
||||
role: organizationRole
|
||||
},
|
||||
});
|
||||
|
||||
return role !== "pending";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user