Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 13540:cc67109ce502
mod_admin_shell: Allow assigning roles to arbitrary JIDs when supported
mod_authz_internal does not support this
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Nov 2024 13:07:25 +0100 |
parent | 13517:4bf889e94831 |
child | 13542:67288253d9a2 |
comparison
equal
deleted
inserted
replaced
13539:006fbd0f0c2f | 13540:cc67109ce502 |
---|---|
1768 if not prosody.hosts[host] then | 1768 if not prosody.hosts[host] then |
1769 return nil, "No such host: "..host; | 1769 return nil, "No such host: "..host; |
1770 elseif prosody.hosts[userhost] and not um.user_exists(username, userhost) then | 1770 elseif prosody.hosts[userhost] and not um.user_exists(username, userhost) then |
1771 return nil, "No such user"; | 1771 return nil, "No such user"; |
1772 end | 1772 end |
1773 return um.set_user_role(username, host, new_role); | 1773 if userhost == host then |
1774 return um.set_user_role(username, userhost, new_role); | |
1775 else | |
1776 return um.set_jid_role(jid, host, new_role); | |
1777 end | |
1774 end | 1778 end |
1775 | 1779 |
1776 describe_command [[user:addrole(jid, host, role) - Add a secondary role to a user]] | 1780 describe_command [[user:addrole(jid, host, role) - Add a secondary role to a user]] |
1777 function def_env.user:addrole(jid, host, new_role) | 1781 function def_env.user:addrole(jid, host, new_role) |
1778 local username, userhost = jid_split(jid); | 1782 local username, userhost = jid_split(jid); |