No, the default is "off", but keep in mind that if a category has NO restrictions at all, then it is globally accessible.
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.