That's probably the approach I'll take. I was just wondering if there was some inbuilt functionality, but it's not much work to do, so thanks. Have a nice day!
middleware.admin.isAdmin is not needed
-
In your plugins you don't have to call
middleware.admin.isAdmin
this is already handled in core at https://github.com/NodeBB/NodeBB/blob/master/src/routes/index.js#L122-L123Same with middleware.applyCSRF this is called on admin routes as well.
-
user.isAdministrator also exists. Do they perform the same function?
-
@pitaj Yes,
isAdmin()
is the middleware, whereasisAdministrator
is the library method. They are functionally similar, except the middleware handles redirecting the user to403