Software /
code /
prosody
Changeset
10640:5622eda7c5c5
usermanager: Add get_roles() function
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 Feb 2020 17:41:14 +0000 |
parents | 10639:08e3063eb1ac |
children | 10641:85f1cbfd364a |
files | core/usermanager.lua |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/usermanager.lua Wed Feb 05 17:40:50 2020 +0000 +++ b/core/usermanager.lua Wed Feb 05 17:41:14 2020 +0000 @@ -137,7 +137,7 @@ return hosts[host].users; end -local function is_admin(jid, host) +local function get_roles(jid, host) if host and not hosts[host] then return false; end if type(jid) ~= "string" then return false; end @@ -155,6 +155,11 @@ roles = authz_provider.get_jid_roles(jid); end + return roles; +end + +local function is_admin(jid, host) + local roles = get_roles(jid, host); return roles and roles["prosody:admin"]; end @@ -170,5 +175,6 @@ users = users; get_sasl_handler = get_sasl_handler; get_provider = get_provider; + get_roles = get_roles; is_admin = is_admin; };