From 3fb671e0a3ebec083770b6ea0bf91b1489ebf833 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 5 Feb 2020 17:41:14 +0000 Subject: usermanager: Add get_roles() function --- core/usermanager.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/usermanager.lua b/core/usermanager.lua index 4a1e18f9..acdc7909 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -137,7 +137,7 @@ local function get_provider(host) 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 @@ local function is_admin(jid, host) 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 @@ return { users = users; get_sasl_handler = get_sasl_handler; get_provider = get_provider; + get_roles = get_roles; is_admin = is_admin; }; -- cgit v1.2.3