-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(team): 🛂 Improve collab permissions
- Loading branch information
1 parent
8d6330f
commit bb194b1
Showing
14 changed files
with
101 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
apps/builder/pages/api/typebots/[typebotId]/collaborators/[userId].ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
apps/builder/pages/api/typebots/[typebotId]/invitations/[email].ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
apps/builder/pages/api/typebots/[typebotId]/results/[resultId]/logs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { CollaborationType, Prisma, User } from 'db' | ||
|
||
const parseWhereFilter = ( | ||
typebotId: string, | ||
user: User, | ||
type: 'read' | 'write' | ||
): Prisma.TypebotWhereInput => ({ | ||
OR: [ | ||
{ | ||
id: typebotId, | ||
ownerId: | ||
(type === 'read' && user.email === process.env.ADMIN_EMAIL) || | ||
process.env.NEXT_PUBLIC_E2E_TEST | ||
? undefined | ||
: user.id, | ||
}, | ||
{ | ||
id: typebotId, | ||
collaborators: { | ||
some: { | ||
userId: user.id, | ||
type: type === 'write' ? CollaborationType.WRITE : undefined, | ||
}, | ||
}, | ||
}, | ||
], | ||
}) | ||
|
||
export const canReadTypebot = (typebotId: string, user: User) => | ||
parseWhereFilter(typebotId, user, 'read') | ||
|
||
export const canWriteTypebot = (typebotId: string, user: User) => | ||
parseWhereFilter(typebotId, user, 'write') |
Oops, something went wrong.
bb194b1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
landing-page-v2 – ./apps/landing-page
landing-page-v2-git-main-typebot-io.vercel.app
typebot.io
landing-page-v2-typebot-io.vercel.app
get-typebot.com
www.typebot.io
www.get-typebot.com
bb194b1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
builder-v2 – ./apps/builder
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
bb194b1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
yoda.riku.ai
bot.tvbeat.it
bot.joof.it
app.yvon.earth
bergamo.store
danyservice.it
talk.gocare.io
frankmeuche.de
chat.hayuri.id
gollum.riku.ai
fitness.riku.ai
zap.fundviser.in
bot.rihabilita.it
bot.jesopizz.it
bot.contakit.com
viewer.typebot.io
bot.dsignagency.com
88584434.therpm.club
chatbot.matthesv.de
demo.wemakebots.xyz
92109660.therpm.club
bot.barrettamario.it
hello.advergreen.com
bot.outstandbrand.com
bot.digitalpointer.id
bot.robertohairlab.it
bot.ilmuseoaiborghi.it
criar.somaperuzzo.com
bot.pratikmandalia.com
form.bridesquadapp.com
michaeljackson.riku.ai
87656003.actualizar.xyz
91375310.actualizar.xyz
arrivalx2.wpwakanda.com
bot.hotelplayarimini.it
invite.bridesquadapp.com
link.venturasuceder.com
chat.thehomebuyersusa.com
bot.amicidisanfaustino.it
typebot-viewer.vercel.app
forms.hiabhaykulkarni.com
bot.adventureconsulting.hu
mainmenu1one.wpwakanda.com
chat.atlasoutfittersk9.com
liveconvert.kandalearn.com
homepageonly.wpwakanda.com
casestudyemb.wpwakanda.com
bot.pinpointinteractive.com
tarian.theiofoundation.org
bot.seidinembroseanchetu.it
bot.polychromes-project.com
liveconvert2.kandalearn.com
bot.seidibergamoseanchetu.it
forms.escoladeautomacao.com.br
bot.studiotecnicoimmobiliaremerelli.it
viewer-v2-git-main-typebot-io.vercel.app
viewer-v2-typebot-io.vercel.app