Only check roles if a user when accessing pages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
90f1750945
commit
8d05864c15
@ -51,8 +51,10 @@ export const isAdminOrSelf = ({ req: { user } }: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const isAdminOrPublished = ({ req: { user } }: any) => {
|
export const isAdminOrPublished = ({ req: { user } }: any) => {
|
||||||
if (user.roles?.includes('admin')) {
|
if (user && user.roles) {
|
||||||
return true
|
if (user.roles?.includes('admin')) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user