Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit fcb6f90

Browse files
committed
Remove un-used hasAuthorization and requiresLogin
Looks like these aren't needed now that we have ACL.
1 parent 3ea400f commit fcb6f90

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

modules/users/server/controllers/users/users.authorization.server.controller.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,3 @@ exports.userByID = function(req, res, next, id) {
2020
next();
2121
});
2222
};
23-
24-
/**
25-
* Require login routing middleware
26-
*/
27-
exports.requiresLogin = function(req, res, next) {
28-
if (!req.isAuthenticated()) {
29-
return res.status(401).send({
30-
message: 'User is not logged in'
31-
});
32-
}
33-
34-
next();
35-
};
36-
37-
/**
38-
* User authorizations routing middleware
39-
*/
40-
exports.hasAuthorization = function(roles) {
41-
var _this = this;
42-
43-
return function(req, res, next) {
44-
_this.requiresLogin(req, res, function() {
45-
if (_.intersection(req.user.roles, roles).length) {
46-
return next();
47-
} else {
48-
return res.status(403).send({
49-
message: 'User is not authorized'
50-
});
51-
}
52-
});
53-
};
54-
};

0 commit comments

Comments
 (0)