1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-05-18 23:01:02 +00:00
bramw_baserow/web-frontend/modules/core/middleware/staff.js
2021-02-17 20:36:11 +00:00

13 lines
420 B
JavaScript

/**
* This middleware makes sure that the current user is admin 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.' })
}
}