aboutsummaryrefslogtreecommitdiffstats
path: root/core/usermanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-02-05 17:41:14 +0000
committerMatthew Wild <mwild1@gmail.com>2020-02-05 17:41:14 +0000
commit3fb671e0a3ebec083770b6ea0bf91b1489ebf833 (patch)
tree777a8566afb54a1fcbc47ebfd9803037cf3ab46c /core/usermanager.lua
parentfd3ee50a8c1aa3029d8edecf584bea8acda9edc7 (diff)
downloadprosody-3fb671e0a3ebec083770b6ea0bf91b1489ebf833.tar.gz
prosody-3fb671e0a3ebec083770b6ea0bf91b1489ebf833.zip
usermanager: Add get_roles() function
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r--core/usermanager.lua8
1 files changed, 7 insertions, 1 deletions
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;
};