From e1c577023ce81a92e8fdba319947ce0e662636e6 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Tue, 14 Nov 2017 16:22:19 -0600 Subject: [PATCH] Fix permission check in optout plugin --- plugins/core/optout.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/core/optout.py b/plugins/core/optout.py index daafc2064..b54fc845e 100644 --- a/plugins/core/optout.py +++ b/plugins/core/optout.py @@ -221,8 +221,8 @@ def check_global_perms(event): if chan.lower() == "global": if not can_global: - event.notice("You do not have permission to view global opt outs") - return + event.notice("You do not have permission to access global opt outs") + allowed = False chan = None @@ -240,6 +240,9 @@ def list_optout(conn, event, async_call): """ chan, allowed = yield from check_global_perms(event) + if not allowed: + return + opts = yield from async_call(get_channel_optouts, conn.name, chan) table = yield from async_call(format_optout_list, opts) @@ -252,6 +255,9 @@ def clear(conn, event, db, async_call): """[channel] - Clears the optout list for a channel. Specify "global" to clear all data for this network""" chan, allowed = yield from check_global_perms(event) + if not allowed: + return + count = yield from async_call(clear_optout, db, conn.name, chan) return "Cleared {} opt outs from the list.".format(count)