Software /
code /
prosody
Changeset
12019:a0b6896bb538
mod_admin_shell: Handle global roles (pass host=*)
Is it not odd that um.set_roles() takes `nil` to mean global?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 06 Dec 2021 22:33:46 +0100 |
parents | 12018:c65789f5004e |
children | 12020:a949f1aae171 |
files | plugins/mod_admin_shell.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Mon Dec 06 22:23:38 2021 +0100 +++ b/plugins/mod_admin_shell.lua Mon Dec 06 22:33:46 2021 +0100 @@ -1333,11 +1333,12 @@ 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