1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/middleware/staff.js
Jeremie Pardou-Piquemal 210c02085d Add RBAC to Baserow.
2022-10-28 18:45:34 +01:00

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.' })
}
}