|
|
@ -150,7 +150,8 @@
|
|
|
|
gid: gid,
|
|
|
|
gid: gid,
|
|
|
|
name: name,
|
|
|
|
name: name,
|
|
|
|
description: description,
|
|
|
|
description: description,
|
|
|
|
deleted: '0'
|
|
|
|
deleted: '0',
|
|
|
|
|
|
|
|
hidden: '0'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.exec(function (err) {
|
|
|
|
.exec(function (err) {
|
|
|
|
Groups.get(gid, {}, callback);
|
|
|
|
Groups.get(gid, {}, callback);
|
|
|
@ -162,6 +163,16 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Groups.hide = function(gid) {
|
|
|
|
|
|
|
|
Groups.exists(gid, function(err, exists) {
|
|
|
|
|
|
|
|
if (exists) {
|
|
|
|
|
|
|
|
Groups.update(gid, {
|
|
|
|
|
|
|
|
hidden: '1'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Groups.update = function(gid, values, callback) {
|
|
|
|
Groups.update = function(gid, values, callback) {
|
|
|
|
RDB.exists('gid:' + gid, function (err, exists) {
|
|
|
|
RDB.exists('gid:' + gid, function (err, exists) {
|
|
|
|
if (!err && exists) {
|
|
|
|
if (!err && exists) {
|
|
|
@ -186,6 +197,7 @@
|
|
|
|
Groups.getGidFromName(groupName, function(err, gid) {
|
|
|
|
Groups.getGidFromName(groupName, function(err, gid) {
|
|
|
|
if (err || !gid) {
|
|
|
|
if (err || !gid) {
|
|
|
|
Groups.create(groupName, '', function(err, groupObj) {
|
|
|
|
Groups.create(groupName, '', function(err, groupObj) {
|
|
|
|
|
|
|
|
Groups.hide(groupObj.gid);
|
|
|
|
Groups.join(groupObj.gid, uid, callback);
|
|
|
|
Groups.join(groupObj.gid, uid, callback);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|