diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-06 22:33:46 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-06 22:33:46 +0100 |
commit | 9f2249b3dbdb86deae5d9ffde1a7a587dc02c4a1 (patch) | |
tree | 8902a6cea6c4b0194feb2af74c9f111c27a01a71 /plugins | |
parent | a45484c1313e25faa7cad4bdc7cd71f1a459f2f4 (diff) | |
download | prosody-9f2249b3dbdb86deae5d9ffde1a7a587dc02c4a1.tar.gz prosody-9f2249b3dbdb86deae5d9ffde1a7a587dc02c4a1.zip |
mod_admin_shell: Handle global roles (pass host=*)
Is it not odd that um.set_roles() takes `nil` to mean global?
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_shell.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index 98ddc7e3..526430db 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -1333,11 +1333,12 @@ end function def_env.user:roles(jid, host, new_roles) local username, userhost = jid_split(jid); if new_roles == nil then host, new_roles = userhost, host; end - if not prosody.hosts[host] then + if host ~= "*" and not prosody.hosts[host] then return nil, "No such host: "..host; elseif prosody.hosts[userhost] and not um.user_exists(username, userhost) then return nil, "No such user"; end + if host == "*" then host = nil; end return um.set_roles(jid, host, coerce_roles(new_roles)); end |