* User.isGroupMember() can now take a string or array of strings to check

* Add WELCOME2.ANS
* Disallow "all" as a username
* Check group membership when switching areas
This commit is contained in:
Bryan Ashby 2015-11-04 23:04:55 -07:00
parent d2866df97f
commit 5bd95255a3
6 changed files with 22 additions and 7 deletions

View file

@ -78,8 +78,13 @@ function changeMessageArea(client, areaName, cb) {
}
},
function validateAccess(area, callback) {
// :TODO: validate user has access to |area| -- must belong to group(s) specified
callback(null, area);
if(_.isArray(area.groups) && !
client.user.isGroupMember(area.groups))
{
callback(new Error('User does not have access to this area'));
} else {
callback(null, area);
}
},
function changeArea(area, callback) {
client.user.persistProperty('message_area_name', area.name, function persisted(err) {