updated groups to stop you from removing yourself from the admin group

v1.18.x
Josh Rickers 11 years ago
parent bac1a5ec3e
commit a91e464787

@ -2,7 +2,8 @@ define(function() {
var Groups = {};
Groups.init = function() {
var createEl = document.getElementById('create'),
var yourid = templates.get('yourid'),
createEl = document.getElementById('create'),
createModal = $('#create-modal'),
createSubmitBtn = document.getElementById('create-modal-go'),
createNameEl = $('#create-group-name'),
@ -172,6 +173,12 @@ define(function() {
var uid = this.getAttribute('data-uid'),
gid = detailsModal.attr('data-gid');
socket.emit('admin.groups.get', gid, function(err, groupObj){
if (!err){
if (groupObj.name == 'Administrators' && uid == yourid){
bootbox.alert('You cannot remove yourself from the Administrator Group');
return;
}
bootbox.confirm('Are you sure you want to remove this user?', function(confirm) {
if (confirm){
socket.emit('admin.groups.leave', {
@ -184,6 +191,8 @@ define(function() {
});
}
});
}
});
});
detailsModalSave.on('click', function() {

Loading…
Cancel
Save