mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
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;
|