ACP groups delete calls generic groups socket listener now, #2588

This commit is contained in:
Julian Lam
2015-01-11 18:17:49 -05:00
parent 08e883de44
commit 765975e667
3 changed files with 18 additions and 6 deletions

View File

@@ -101,4 +101,18 @@ SocketGroups.update = function(socket, data, callback) {
});
};
SocketGroups.delete = function(socket, data, callback) {
if(!data) {
return callback(new Error('[[error:invalid-data]]'));
}
groups.ownership.isOwner(socket.uid, data.groupName, function(err, isOwner) {
if (!isOwner) {
return callback(new Error('[[error:no-privileges]]'));
}
groups.destroy(data.groupName, callback);
});
};
module.exports = SocketGroups;