Fix: don't search channel library if rank < seeplaylist

This commit is contained in:
calzoneman 2014-09-04 20:53:18 -05:00
parent bc3f20198c
commit 71114b0060
4 changed files with 23 additions and 3 deletions

View File

@ -77,7 +77,8 @@ LibraryModule.prototype.handleSearchMedia = function (user, data) {
}); });
}; };
if (data.source === "yt" || !this.channel.is(Flags.C_REGISTERED)) { if (data.source === "yt" || !this.channel.is(Flags.C_REGISTERED) ||
!this.channel.modules.permissions.canSeePlaylist(user)) {
searchYT(); searchYT();
} else { } else {
db.channels.searchLibrary(this.channel.name, query, function (err, res) { db.channels.searchLibrary(this.channel.name, query, function (err, res) {

View File

@ -13,8 +13,8 @@ html(lang="en")
- var cname = "/r/" + channelName - var cname = "/r/" + channelName
ul.nav.navbar-nav ul.nav.navbar-nav
mixin navdefaultlinks(cname) mixin navdefaultlinks(cname)
li: a(href="#", onclick="javascript:showUserOptions()") Options li: a(href="javascript:void(0)", onclick="javascript:showUserOptions()") Options
li: a#showchansettings(href="#", onclick="javascript:$('#channeloptions').modal()") Channel Settings li: a#showchansettings(href="javascript:void(0)", onclick="javascript:$('#channeloptions').modal()") Channel Settings
li.dropdown li.dropdown
a.dropdown-toggle(href="#", data-toggle="dropdown") Layout a.dropdown-toggle(href="#", data-toggle="dropdown") Layout
b.caret b.caret

View File

@ -242,6 +242,15 @@ $("#newpollbtn").click(showPollMenu);
/* search controls */ /* search controls */
$("#library_search").click(function() { $("#library_search").click(function() {
if (!hasPermission("seeplaylist")) {
$("#searchcontrol .alert").remove();
var al = makeAlert("Permission Denied",
"This channel does not allow you to search its library",
"alert-danger");
al.find(".alert").insertAfter($("#library_query").parent());
return;
}
socket.emit("searchMedia", { socket.emit("searchMedia", {
source: "library", source: "library",
query: $("#library_query").val().toLowerCase() query: $("#library_query").val().toLowerCase()
@ -250,6 +259,15 @@ $("#library_search").click(function() {
$("#library_query").keydown(function(ev) { $("#library_query").keydown(function(ev) {
if(ev.keyCode == 13) { if(ev.keyCode == 13) {
if (!hasPermission("seeplaylist")) {
$("#searchcontrol .alert").remove();
var al = makeAlert("Permission Denied",
"This channel does not allow you to search its library",
"alert-danger");
al.find(".alert").insertAfter($("#library_query").parent());
return;
}
socket.emit("searchMedia", { socket.emit("searchMedia", {
source: "library", source: "library",
query: $("#library_query").val().toLowerCase() query: $("#library_query").val().toLowerCase()

View File

@ -914,6 +914,7 @@ function handlePermissionChange() {
setVisible("#plmeta", hasPermission("seeplaylist")); setVisible("#plmeta", hasPermission("seeplaylist"));
$("#getplaylist").attr("disabled", !hasPermission("seeplaylist")); $("#getplaylist").attr("disabled", !hasPermission("seeplaylist"));
setVisible("#showplaylistmanager", hasPermission("seeplaylist"));
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"));