2013-02-16 17:19:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2013 Calvin 'calzoneman' Montgomery
|
|
|
|
*
|
|
|
|
* Licensed under Creative Commons Attribution-NonCommercial 3.0
|
|
|
|
* See http://creativecommons.org/licenses/by-nc/3.0/
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-02-16 05:02:42 +00:00
|
|
|
exports.Guest = 0;
|
|
|
|
exports.Member = 1;
|
2013-03-05 23:06:25 +00:00
|
|
|
exports.Moderator = 2;
|
|
|
|
exports.Owner = 3;
|
2013-02-16 05:02:42 +00:00
|
|
|
exports.Siteadmin = 255;
|
|
|
|
|
|
|
|
var permissions = {
|
2013-03-20 18:35:06 +00:00
|
|
|
acp : exports.Siteadmin,
|
|
|
|
announce : exports.Siteadmin,
|
|
|
|
registerChannel : exports.Owner,
|
|
|
|
queue : exports.Moderator,
|
|
|
|
assignLeader : exports.Moderator,
|
|
|
|
kick : exports.Moderator,
|
|
|
|
promote : exports.Moderator,
|
|
|
|
qlock : exports.Moderator,
|
|
|
|
poll : exports.Moderator,
|
|
|
|
shout : exports.Moderator,
|
2013-03-22 20:04:04 +00:00
|
|
|
channelOpts : exports.Moderator,
|
2013-03-20 18:35:06 +00:00
|
|
|
search : exports.Guest,
|
|
|
|
chat : exports.Guest,
|
2013-02-16 05:02:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Check if someone has permission to do shit
|
|
|
|
exports.hasPermission = function(user, what) {
|
|
|
|
if(what in permissions) {
|
|
|
|
return user.rank >= permissions[what];
|
|
|
|
}
|
|
|
|
else return false;
|
|
|
|
}
|