# HG changeset patch # User Matthew Wild # Date 1580924474 0 # Node ID 5622eda7c5c59f6f12c039eba97b923f1c3ad5a1 # Parent 08e3063eb1aca3cacc7862bff572782499affb7b usermanager: Add get_roles() function diff -r 08e3063eb1ac -r 5622eda7c5c5 core/usermanager.lua --- 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; };