From 3315a2f6164b5ed85e67bf61900c452fe23d2bc6 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 12 Nov 2021 13:25:09 +0000 Subject: usermanager: Fire user-roles-changed event when updating roles of a local user --- 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 55faa0c9..e3b9b797 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -174,7 +174,13 @@ local function set_roles(jid, host, roles) local authz_provider = (host ~= "*" and hosts[host].authz) or global_authz_provider; if actor_user and actor_host == host then -- Local user - return authz_provider.set_user_roles(actor_user, roles) + local ok, err = authz_provider.set_user_roles(actor_user, roles); + if ok then + prosody.events.fire_event("user-roles-changed", { + username = actor_user, host = actor_host + }); + end + return ok, err; else -- Remote entity return authz_provider.set_jid_roles(jid, roles) end -- cgit v1.2.3