Setting Admin Roll With Hook
here is my hook in my auth config
i checked that ctx.body.role = 'ADMIN' throughout this hook
but when the user is created in my database their role is 'USER'
I assume this comes from my
@default(USER)
on my prisma schema but why is this occuring if the role is set to user via the before hook?
originally I had this logic in databaseHooks but I moved it to hooks so that I can use the
required: true
flag on the [user][additional fields]
/* for now ill move logic back to databaseHooks */7 Replies
update i thought i found my mistake by not returning a context, as so
but ALAS the name gets changed but the role is still "USER" 😦
bump
Are you sure your logic is correct and that
if
statement does return true for role
to be admin?Pretty sure I did console logging throughout the hook
I can try again since I moved the logic for role to database hooks
I added the name just to show a 1-1 parallel and the name does get changed
Might be easier to test if you can hardcode role in the return to just be
ADMIN
and see if that works.no dice


this is how sign up is being called originally for reference although i assume this happens before the hook