aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-06-15 23:04:17 +0200
committerKim Alvefur <zash@zash.se>2022-06-15 23:04:17 +0200
commitaf339f0e66480da6825fd655a5bf35e2824cfc00 (patch)
tree4c21d15ba996e7b9b7b2000b8cce7ca485515cc8
parentc776c71066e22eff9f8c5b0401946513bd22f103 (diff)
downloadprosody-af339f0e66480da6825fd655a5bf35e2824cfc00.tar.gz
prosody-af339f0e66480da6825fd655a5bf35e2824cfc00.zip
core.moduleapi: Expand permission name ':' prefix earlier
Ensures it applies to the context as string case Somehow this fixes everything
-rw-r--r--core/moduleapi.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 0652e032..fe248c20 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -615,6 +615,9 @@ function api:default_permissions(role_name, permissions)
end
function api:may(action, context)
+ if action:byte(1) == 58 then -- action begins with ':'
+ action = self.name..action; -- prepend module name
+ end
if type(context) == "string" then -- check JID permissions
local role;
local node, host = jid_split(context);
@@ -638,9 +641,6 @@ function api:may(action, context)
if not session then
error("Unable to identify actor session from context");
end
- if action:byte(1) == 58 then -- action begins with ':'
- action = self.name..action; -- prepend module name
- end
if session.type == "s2sin" or (session.type == "c2s" and session.host ~= self.host) then
local actor_jid = context.stanza.attr.from;
local role = hosts[self.host].authz.get_jid_role(actor_jid);