You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2018/08/18 00:20:12 UTC
[12/14] helix git commit: Skip admin check if called authorize
http://git-wip-us.apache.org/repos/asf/helix/blob/f1c50371/helix-front/server/controllers/user.ts
----------------------------------------------------------------------
diff --git a/helix-front/server/controllers/user.ts b/helix-front/server/controllers/user.ts
index 1cd5288..21e1b0f 100644
--- a/helix-front/server/controllers/user.ts
+++ b/helix-front/server/controllers/user.ts
@@ -17,16 +17,14 @@ export class UserCtrl {
// please rewrite this function to support your own authorization logic
protected authorize(req: Request, res: Response) {
if (req.query.name) {
+ // since it's bypass mode, skip admin check
req.session.username = req.query.name;
- CheckAdmin(req.session.username, (isAdmin: boolean) => {
- req.session.isAdmin = isAdmin;
- if (req.query.url) {
- res.redirect(req.query.url);
- } else {
- res.redirect('/');
- }
- });
+ if (req.query.url) {
+ res.redirect(req.query.url);
+ } else {
+ res.redirect('/');
+ }
} else {
res.status(401).send('Unauthorized');
}