Always amend the admin flag for further use

This commit is contained in:
Johannes Zellner
2016-02-25 11:40:48 +01:00
parent df102ec374
commit 93c1ddd982
+9 -1
View File
@@ -16,6 +16,7 @@ var assert = require('assert'),
debug = require('debug')('box:auth'),
LocalStrategy = require('passport-local').Strategy,
crypto = require('crypto'),
groups = require('./groups'),
passport = require('passport'),
tokendb = require('./tokendb'),
user = require('./user'),
@@ -123,7 +124,14 @@ function initialize(callback) {
// amend the tokenType of the token owner
user.tokenType = tokenType;
callback(null, user, info);
// amend the admin flag
groups.isMember(groups.ADMIN_GROUP_ID, user.id, function (error, isAdmin) {
if (error) return callback(error);
user.admin = isAdmin;
callback(null, user, info);
});
});
});
}));