Software /
code /
prosody
Diff
core/usermanager.lua @ 10640:5622eda7c5c5
usermanager: Add get_roles() function
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 Feb 2020 17:41:14 +0000 |
parent | 10635:675d9fbcbaed |
child | 10659:8f95308c3c45 |
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; };