Yes, indeed, if you're looking to scale up to handle high concurrent user loads, scaling out horizontally is your best bet. We've got a client right now serving 700+ connections at the moment, and they're on four separate NodeBB instances. It's probably too much for what they need, but it's always nice to have more capacity than needed in case of spikes, etc.
How to check if user is admin?
-
Is there a quicker way to tell, on the server-side, in a plugin, if the current user is an admin?
Right now, I'm doing this:
groups.isMember(req.user, "administrators", function(err, bool){ if(bool){ // do stuff } });
Is there a shortcut to that?
Thanks.
-
Could be worth checking what psychobunny did in this plugin. Looks pretty similar, except he checks against the user, not the group.
-
groups.isMember
takes in user id as the first param so your code should bevar uid = req.user ? req.user.uid : 0; groups.isMember(uid, "administrators", function(err, bool) { });
Alternatively you can use
var uid = req.user ? req.user.uid : 0; user.isAdministrator(uid, function(err, isAdmin) { });
-
Alright, thanks guys.
The
user.isAdministrator
function was what I was looking for.