aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-11-12 13:25:09 +0000
committerMatthew Wild <mwild1@gmail.com>2021-11-12 13:25:09 +0000
commit3315a2f6164b5ed85e67bf61900c452fe23d2bc6 (patch)
treea6e796fc908975038377b3a74638a1f90f32463a
parentd6b3625be21223fd05d103fc132f753747965c6d (diff)
downloadprosody-3315a2f6164b5ed85e67bf61900c452fe23d2bc6.tar.gz
prosody-3315a2f6164b5ed85e67bf61900c452fe23d2bc6.zip
usermanager: Fire user-roles-changed event when updating roles of a local user
-rw-r--r--core/usermanager.lua8
1 files changed, 7 insertions, 1 deletions
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