mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-21 23:37:55 +00:00
14 lines
420 B
JavaScript
14 lines
420 B
JavaScript
/**
|
|
* This middleware makes sure that the current user is staff else a 403 error
|
|
* will be shown to the user.
|
|
*/
|
|
export default function ({ store, req, error }) {
|
|
// If nuxt generate, pass this middleware
|
|
if (process.server && !req) return
|
|
|
|
// If the user is not staff we want to show a forbidden error.
|
|
if (!store.getters['auth/isStaff']) {
|
|
return error({ statusCode: 403, message: 'Forbidden.' })
|
|
}
|
|
}
|