|
|
@ -102,7 +102,7 @@ SocketGroups.reject = function(socket, data, callback) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SocketGroups.update = function(socket, data, callback) {
|
|
|
|
SocketGroups.update = function(socket, data, callback) {
|
|
|
|
if(!data) {
|
|
|
|
if (!data) {
|
|
|
|
return callback(new Error('[[error:invalid-data]]'));
|
|
|
|
return callback(new Error('[[error:invalid-data]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +130,7 @@ SocketGroups.create = function(socket, data, callback) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SocketGroups.delete = function(socket, data, callback) {
|
|
|
|
SocketGroups.delete = function(socket, data, callback) {
|
|
|
|
if(!data) {
|
|
|
|
if (!data) {
|
|
|
|
return callback(new Error('[[error:invalid-data]]'));
|
|
|
|
return callback(new Error('[[error:invalid-data]]'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -156,6 +156,20 @@ SocketGroups.search = function(socket, data, callback) {
|
|
|
|
groups.search(data.query || '', data.options || {}, callback);
|
|
|
|
groups.search(data.query || '', data.options || {}, callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SocketGroups.kick = 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.leave(data.groupName, data.uid, callback);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SocketGroups.cover = {};
|
|
|
|
SocketGroups.cover = {};
|
|
|
|
|
|
|
|
|
|
|
|
SocketGroups.cover.get = function(socket, data, callback) {
|
|
|
|
SocketGroups.cover.get = function(socket, data, callback) {
|
|
|
@ -163,7 +177,7 @@ SocketGroups.cover.get = function(socket, data, callback) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SocketGroups.cover.update = function(socket, data, callback) {
|
|
|
|
SocketGroups.cover.update = function(socket, data, callback) {
|
|
|
|
if(!data) {
|
|
|
|
if (!data) {
|
|
|
|
return callback(new Error('[[error:invalid-data]]'));
|
|
|
|
return callback(new Error('[[error:invalid-data]]'));
|
|
|
|
} else if (socket.uid === 0) {
|
|
|
|
} else if (socket.uid === 0) {
|
|
|
|
return callback(new Error('[[error:no-privileges]]'));
|
|
|
|
return callback(new Error('[[error:no-privileges]]'));
|
|
|
|