mirror of https://github.com/calzoneman/sync.git
Add new permission nodes
This commit is contained in:
parent
6e2d9c3caa
commit
21af0af1be
|
@ -73,6 +73,9 @@ function Channel(name) {
|
||||||
ban: 2, // Ban other users
|
ban: 2, // Ban other users
|
||||||
motdedit: 3, // Edit the MOTD
|
motdedit: 3, // Edit the MOTD
|
||||||
filteredit: 3, // Control chat filters
|
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
|
drink: 1.5, // Use the /d command
|
||||||
chat: 0 // Send chat messages
|
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
|
* Handles a user message to change the locked state of the playlist
|
||||||
*/
|
*/
|
||||||
Channel.prototype.handleSetLock = function (user, data) {
|
Channel.prototype.handleSetLock = function (user, data) {
|
||||||
// TODO permission node?
|
if (!this.hasPermission(user, "playlistlock")) {
|
||||||
if (user.rank < 2) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2161,8 +2163,7 @@ Channel.prototype.importFilters = function (filters) {
|
||||||
* Handles a user message to import a list of chat filters
|
* Handles a user message to import a list of chat filters
|
||||||
*/
|
*/
|
||||||
Channel.prototype.handleImportFilters = function (user, data) {
|
Channel.prototype.handleImportFilters = function (user, data) {
|
||||||
// TODO change to filterimport
|
if (!this.hasPermission(user, "filterimport")) {
|
||||||
if (!this.hasPermission(user, "filteredit")) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2776,8 +2777,7 @@ Channel.prototype.changeLeader = function (name) {
|
||||||
* Handles a user message to assign a new leader
|
* Handles a user message to assign a new leader
|
||||||
*/
|
*/
|
||||||
Channel.prototype.handleChangeLeader = function (user, data) {
|
Channel.prototype.handleChangeLeader = function (user, data) {
|
||||||
// TODO permission node?
|
if (!this.hasPermission(user, "leaderctl")) {
|
||||||
if (user.rank < 2) {
|
|
||||||
user.kick("Attempted assignLeader with insufficient permission");
|
user.kick("Attempted assignLeader with insufficient permission");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,8 +190,8 @@ function addUserDropdown(entry) {
|
||||||
ignore.text("Unignore User");
|
ignore.text("Unignore User");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* gib/remove leader (moderator+ only) */
|
/* give/remove leader (moderator+ only) */
|
||||||
if(CLIENT.rank >= 2) {
|
if (hasPermission("leaderctl")) {
|
||||||
var ldr = $("<button/>").addClass("btn btn-xs btn-default")
|
var ldr = $("<button/>").addClass("btn btn-xs btn-default")
|
||||||
.appendTo(btngroup);
|
.appendTo(btngroup);
|
||||||
if(leader) {
|
if(leader) {
|
||||||
|
@ -829,6 +829,8 @@ function handleModPermissions() {
|
||||||
setParentVisible("a[href='#cs-filtereditor']", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-filtereditor']", CLIENT.rank >= 3);
|
||||||
setParentVisible("a[href='#cs-chanranks']", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-chanranks']", CLIENT.rank >= 3);
|
||||||
setParentVisible("a[href='#cs-chanlog']", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-chanlog']", CLIENT.rank >= 3);
|
||||||
|
$("#qlockbtn").attr("disabled", !hasPermission("playlistlock"));
|
||||||
|
$("#cs-chatfilters-import").attr("disabled", !hasPermission("filterimport"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePermissionChange() {
|
function handlePermissionChange() {
|
||||||
|
@ -846,7 +848,6 @@ function handlePermissionChange() {
|
||||||
setVisible("#showmediaurl", hasPermission("playlistadd"));
|
setVisible("#showmediaurl", hasPermission("playlistadd"));
|
||||||
setVisible("#showcustomembed", hasPermission("playlistaddcustom"));
|
setVisible("#showcustomembed", hasPermission("playlistaddcustom"));
|
||||||
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||||
$("#qlockbtn").attr("disabled", CLIENT.rank < 2);
|
|
||||||
|
|
||||||
if(hasPermission("playlistadd") ||
|
if(hasPermission("playlistadd") ||
|
||||||
hasPermission("playlistmove") ||
|
hasPermission("playlistmove") ||
|
||||||
|
@ -1371,7 +1372,6 @@ function chatOnly() {
|
||||||
|
|
||||||
/* channel administration stuff */
|
/* channel administration stuff */
|
||||||
|
|
||||||
// TODO fix
|
|
||||||
function genPermissionsEditor() {
|
function genPermissionsEditor() {
|
||||||
$("#cs-permedit").html("");
|
$("#cs-permedit").html("");
|
||||||
var form = $("<form/>").addClass("form-horizontal")
|
var form = $("<form/>").addClass("form-horizontal")
|
||||||
|
@ -1457,6 +1457,7 @@ function genPermissionsEditor() {
|
||||||
makeOption("Exceed maximum media length", "exceedmaxlength", standard, CHANNEL.perms.exceedmaxlength+"");
|
makeOption("Exceed maximum media length", "exceedmaxlength", standard, CHANNEL.perms.exceedmaxlength+"");
|
||||||
makeOption("Add nontemporary media", "addnontemp", standard, CHANNEL.perms.addnontemp+"");
|
makeOption("Add nontemporary media", "addnontemp", standard, CHANNEL.perms.addnontemp+"");
|
||||||
makeOption("Temp/untemp playlist item", "settemp", standard, CHANNEL.perms.settemp+"");
|
makeOption("Temp/untemp playlist item", "settemp", standard, CHANNEL.perms.settemp+"");
|
||||||
|
makeOption("Lock/unlock playlist", "playlistlock", modleader, CHANNEL.perms.playlistlock+"");
|
||||||
makeOption("Shuffle playlist", "playlistshuffle", standard, CHANNEL.perms.playlistshuffle+"");
|
makeOption("Shuffle playlist", "playlistshuffle", standard, CHANNEL.perms.playlistshuffle+"");
|
||||||
makeOption("Clear playlist", "playlistclear", standard, CHANNEL.perms.playlistclear+"");
|
makeOption("Clear playlist", "playlistclear", standard, CHANNEL.perms.playlistclear+"");
|
||||||
|
|
||||||
|
@ -1467,11 +1468,13 @@ function genPermissionsEditor() {
|
||||||
makeOption("Voteskip", "voteskip", standard, CHANNEL.perms.voteskip+"");
|
makeOption("Voteskip", "voteskip", standard, CHANNEL.perms.voteskip+"");
|
||||||
|
|
||||||
addDivider("Moderation");
|
addDivider("Moderation");
|
||||||
|
makeOption("Assign/Remove leader", "leaderctl", modplus, CHANNEL.perms.leaderctl+"");
|
||||||
makeOption("Mute users", "mute", modleader, CHANNEL.perms.mute+"");
|
makeOption("Mute users", "mute", modleader, CHANNEL.perms.mute+"");
|
||||||
makeOption("Kick users", "kick", modleader, CHANNEL.perms.kick+"");
|
makeOption("Kick users", "kick", modleader, CHANNEL.perms.kick+"");
|
||||||
makeOption("Ban users", "ban", modplus, CHANNEL.perms.ban+"");
|
makeOption("Ban users", "ban", modplus, CHANNEL.perms.ban+"");
|
||||||
makeOption("Edit MOTD", "motdedit", modplus, CHANNEL.perms.motdedit+"");
|
makeOption("Edit MOTD", "motdedit", modplus, CHANNEL.perms.motdedit+"");
|
||||||
makeOption("Edit chat filters", "filteredit", modplus, CHANNEL.perms.filteredit+"");
|
makeOption("Edit chat filters", "filteredit", modplus, CHANNEL.perms.filteredit+"");
|
||||||
|
makeOption("Import chat filters", "filterimport", modplus, CHANNEL.perms.filterimport+"");
|
||||||
|
|
||||||
addDivider("Misc");
|
addDivider("Misc");
|
||||||
makeOption("Drink calls", "drink", modleader, CHANNEL.perms.drink+"");
|
makeOption("Drink calls", "drink", modleader, CHANNEL.perms.drink+"");
|
||||||
|
|
Loading…
Reference in New Issue