You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
907 B
JavaScript

var RDB = require('./../redis.js'),
utils = require('./../../public/src/utils.js'),
user = require('./../user.js');
(function(UserAdmin) {
UserAdmin.makeAdmin = function(uid, theirid, socket) {
user.isAdministrator(uid, function(isAdmin) {
if(isAdmin) {
user.makeAdministrator(theirid, function(data) {
socket.emit('event:alert', {
title: 'User Modified',
message: 'This user is now an administrator!',
type: 'success',
timeout: 2000
});
});
}
});
};
UserAdmin.removeAdmin = function(uid, theirid, socket) {
user.isAdministrator(uid, function(isAdmin) {
if(isAdmin) {
user.removeAdministrator(theirid, function(data) {
socket.emit('event:alert', {
title: 'User Modified',
message: 'This user is no longer an administrator!',
type: 'success',
timeout: 2000
});
});
}
});
};
}(exports));