// If we are passed an email address that should be admin by default, then ensure that user is admin, or mark it as needing to be admin if the user ever logs in.
// Given that this app requires Google OAuth2, and we expect logins to be restricted to district email addresses, this should be very secure.
// console.log("Admin Role Assignment: " + JSON.stringify(assignment));
if(!assignment){
Roles.addUsersToRoles(user._id,['admin']);
}
}
else{
watchForAdmin=true;
}
}
// Listen for users logging in so we can setup the admin user automatically once they log in the first time.
if(watchForAdmin){
// TODO: It would be nice to remove this handler after the admin user is found, but the docs are pretty ambiguous about how to do that. Not a big deal, just annoying.