aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-05-07 13:13:42 +0200
committerKim Alvefur <zash@zash.se>2023-05-07 13:13:42 +0200
commit2b25fcb73270575573ac27723385ea0ebe6a5a48 (patch)
treef5ec9f4252da7c8e42ddabebcbdf423b23f0e549 /plugins
parente83f8984a8c1085a36ff2f4e3cc64eb8912e3869 (diff)
downloadprosody-2b25fcb73270575573ac27723385ea0ebe6a5a48.tar.gz
prosody-2b25fcb73270575573ac27723385ea0ebe6a5a48.zip
mod_adhoc: Silence permission errors when listing commands
Since throwing a pile of 'access denied', even at debug level, seems akin to calling wolf :) Cutting down on debug noise is also good. Passing a flag instead of using module:could seemed easier here.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/adhoc/mod_adhoc.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/adhoc/mod_adhoc.lua b/plugins/adhoc/mod_adhoc.lua
index 4482682d..8abfff99 100644
--- a/plugins/adhoc/mod_adhoc.lua
+++ b/plugins/adhoc/mod_adhoc.lua
@@ -14,8 +14,8 @@ local commands = {};
module:add_feature(xmlns_cmd);
-local function check_permissions(event, node, command)
- return (command.permission == "check" and module:may("adhoc:"..node, event))
+local function check_permissions(event, node, command, execute)
+ return (command.permission == "check" and module:may("adhoc:"..node, event, not execute))
or (command.permission == "local_user" and jid_host(event.stanza.attr.from) == module.host)
or (command.permission == "any");
end
@@ -62,7 +62,7 @@ module:hook("iq-set/host/"..xmlns_cmd..":command", function (event)
local node = stanza.tags[1].attr.node
local command = commands[node];
if command then
- if not check_permissions(event, node, command) then
+ if not check_permissions(event, node, command, true) then
origin.send(st.error_reply(stanza, "auth", "forbidden", "You don't have permission to execute this command"):up()
:add_child(command:cmdtag("canceled")
:tag("note", {type="error"}):text("You don't have permission to execute this command")));