mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
511684c436
refs #5286 - Moved the function into its own file - Added unit tests for the function
18 lines
381 B
JavaScript
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;
|