From 21af0af1be7f984e96d0582c9143b08fbf1ea0b5 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 23 Jan 2014 16:03:50 -0600 Subject: [PATCH] Add new permission nodes --- lib/channel-new.js | 12 ++++++------ www/assets/js/util.js | 11 +++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/channel-new.js b/lib/channel-new.js index cc48a41e..14078af4 100644 --- a/lib/channel-new.js +++ b/lib/channel-new.js @@ -73,6 +73,9 @@ function Channel(name) { ban: 2, // Ban other users motdedit: 3, // Edit the MOTD filteredit: 3, // Control chat filters + filterimport: 3, // Import chat filter list + playlistlock: 2, // Lock/unlock the playlist + leaderctl: 2, // Give/take leader drink: 1.5, // Use the /d command chat: 0 // Send chat messages }; @@ -2131,8 +2134,7 @@ Channel.prototype.setLock = function (locked) { * Handles a user message to change the locked state of the playlist */ Channel.prototype.handleSetLock = function (user, data) { - // TODO permission node? - if (user.rank < 2) { + if (!this.hasPermission(user, "playlistlock")) { return; } @@ -2161,8 +2163,7 @@ Channel.prototype.importFilters = function (filters) { * Handles a user message to import a list of chat filters */ Channel.prototype.handleImportFilters = function (user, data) { - // TODO change to filterimport - if (!this.hasPermission(user, "filteredit")) { + if (!this.hasPermission(user, "filterimport")) { return; } @@ -2776,8 +2777,7 @@ Channel.prototype.changeLeader = function (name) { * Handles a user message to assign a new leader */ Channel.prototype.handleChangeLeader = function (user, data) { - // TODO permission node? - if (user.rank < 2) { + if (!this.hasPermission(user, "leaderctl")) { user.kick("Attempted assignLeader with insufficient permission"); return; } diff --git a/www/assets/js/util.js b/www/assets/js/util.js index a2a546d0..9d536924 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -190,8 +190,8 @@ function addUserDropdown(entry) { ignore.text("Unignore User"); } - /* gib/remove leader (moderator+ only) */ - if(CLIENT.rank >= 2) { + /* give/remove leader (moderator+ only) */ + if (hasPermission("leaderctl")) { var ldr = $("