Ghost/core/server/middleware/decide-is-admin.js
Alex Kleissner 511684c436 Moves the decideIsAdmin into its own file.
refs #5286
- Moved the function into its own file
- Added unit tests for the function
2015-06-09 14:02:22 -07:00

18 lines
381 B
JavaScript

// # DecideIsAdmin Middleware
// Usage: decideIsAdmin(request, result, next)
// After:
// Before:
// App: Blog
//
// Helper function to determine if its an admin page.
var decideIsAdmin;
decideIsAdmin = function decideIsAdmin(req, res, next) {
/*jslint unparam:true*/
res.isAdmin = req.url.lastIndexOf('/ghost/', 0) === 0;
next();
};
module.exports = decideIsAdmin;