closes #2700 allowGroupCreation setting

v1.18.x
barisusakli 10 years ago
parent 149120a186
commit 9bca777320

@ -2,6 +2,7 @@
var async = require('async'),
nconf = require('nconf'),
meta = require('../meta'),
groups = require('../groups'),
user = require('../user'),
helpers = require('./helpers'),
@ -17,7 +18,8 @@ groupsController.list = function(req, res, next) {
return next(err);
}
res.render('groups/list', {
groups: groups
groups: groups,
allowGroupCreation: parseInt(meta.config.allowGroupCreation, 10) === 1
});
});
};

@ -116,12 +116,15 @@ SocketGroups.update = function(socket, data, callback) {
};
SocketGroups.create = function(socket, data, callback) {
if(!data) {
if (!data) {
return callback(new Error('[[error:invalid-data]]'));
} else if (socket.uid === 0) {
return callback(new Error('[[error:no-privileges]]'));
} else if (parseInt(meta.config.allowGroupCreation, 10) !== 1) {
return callback(new Error('[[error:group-creation-disabled]]'));
}
data.ownerUid = socket.uid;
groups.create(data, callback);
};

@ -15,6 +15,15 @@
</p>
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-field="allowGroupCreation"> <strong>Allow Group Creation</strong>
<p class="help-block">
If enabled, users can create groups <em>(Default: disabled)</em>
</p>
</label>
</div>
</form>
</div>
</div>

Loading…
Cancel
Save