# HG changeset patch # User Kim Alvefur # Date 1638826426 -3600 # Node ID a0b6896bb538b4c7b01d39a0846ee644581775bd # Parent c65789f5004e3102c1f72a837e9090f0f93dc6a4 mod_admin_shell: Handle global roles (pass host=*) Is it not odd that um.set_roles() takes `nil` to mean global? diff -r c65789f5004e -r a0b6896bb538 plugins/mod_admin_shell.lua --- 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