Comparison

core/usermanager.lua @ 11898:89aa591bb895

usermanager: Fire user-roles-changed event when updating roles of a local user
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Nov 2021 13:25:09 +0000
parent 11745:3a2d58a39872
child 12020:a949f1aae171
comparison
equal deleted inserted replaced
11897:e84ea5b58b29 11898:89aa591bb895
172 172
173 local actor_user, actor_host = jid_split(jid); 173 local actor_user, actor_host = jid_split(jid);
174 174
175 local authz_provider = (host ~= "*" and hosts[host].authz) or global_authz_provider; 175 local authz_provider = (host ~= "*" and hosts[host].authz) or global_authz_provider;
176 if actor_user and actor_host == host then -- Local user 176 if actor_user and actor_host == host then -- Local user
177 return authz_provider.set_user_roles(actor_user, roles) 177 local ok, err = authz_provider.set_user_roles(actor_user, roles);
178 if ok then
179 prosody.events.fire_event("user-roles-changed", {
180 username = actor_user, host = actor_host
181 });
182 end
183 return ok, err;
178 else -- Remote entity 184 else -- Remote entity
179 return authz_provider.set_jid_roles(jid, roles) 185 return authz_provider.set_jid_roles(jid, roles)
180 end 186 end
181 end 187 end
182 188