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
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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 = $("<button/>").addClass("btn btn-xs btn-default")
|
||||
.appendTo(btngroup);
|
||||
if(leader) {
|
||||
|
@ -829,6 +829,8 @@ function handleModPermissions() {
|
|||
setParentVisible("a[href='#cs-filtereditor']", CLIENT.rank >= 3);
|
||||
setParentVisible("a[href='#cs-chanranks']", 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() {
|
||||
|
@ -846,7 +848,6 @@ function handlePermissionChange() {
|
|||
setVisible("#showmediaurl", hasPermission("playlistadd"));
|
||||
setVisible("#showcustomembed", hasPermission("playlistaddcustom"));
|
||||
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||
$("#qlockbtn").attr("disabled", CLIENT.rank < 2);
|
||||
|
||||
if(hasPermission("playlistadd") ||
|
||||
hasPermission("playlistmove") ||
|
||||
|
@ -1371,7 +1372,6 @@ function chatOnly() {
|
|||
|
||||
/* channel administration stuff */
|
||||
|
||||
// TODO fix
|
||||
function genPermissionsEditor() {
|
||||
$("#cs-permedit").html("");
|
||||
var form = $("<form/>").addClass("form-horizontal")
|
||||
|
@ -1457,6 +1457,7 @@ function genPermissionsEditor() {
|
|||
makeOption("Exceed maximum media length", "exceedmaxlength", standard, CHANNEL.perms.exceedmaxlength+"");
|
||||
makeOption("Add nontemporary media", "addnontemp", standard, CHANNEL.perms.addnontemp+"");
|
||||
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("Clear playlist", "playlistclear", standard, CHANNEL.perms.playlistclear+"");
|
||||
|
||||
|
@ -1467,11 +1468,13 @@ function genPermissionsEditor() {
|
|||
makeOption("Voteskip", "voteskip", standard, CHANNEL.perms.voteskip+"");
|
||||
|
||||
addDivider("Moderation");
|
||||
makeOption("Assign/Remove leader", "leaderctl", modplus, CHANNEL.perms.leaderctl+"");
|
||||
makeOption("Mute users", "mute", modleader, CHANNEL.perms.mute+"");
|
||||
makeOption("Kick users", "kick", modleader, CHANNEL.perms.kick+"");
|
||||
makeOption("Ban users", "ban", modplus, CHANNEL.perms.ban+"");
|
||||
makeOption("Edit MOTD", "motdedit", modplus, CHANNEL.perms.motdedit+"");
|
||||
makeOption("Edit chat filters", "filteredit", modplus, CHANNEL.perms.filteredit+"");
|
||||
makeOption("Import chat filters", "filterimport", modplus, CHANNEL.perms.filterimport+"");
|
||||
|
||||
addDivider("Misc");
|
||||
makeOption("Drink calls", "drink", modleader, CHANNEL.perms.drink+"");
|
||||
|
|
Loading…
Reference in New Issue