Software /
code /
prosody-modules
Changeset
1659:495a093798eb
mod_privilege: added permissions notification on initial presence for entities which are not components
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 02 Apr 2015 21:47:05 +0200 |
parents | 1658:1146cb4493a9 |
children | 1660:d1072db4db44 |
files | mod_privilege/mod_privilege.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_privilege/mod_privilege.lua Tue Mar 31 17:27:13 2015 +0200 +++ b/mod_privilege/mod_privilege.lua Thu Apr 02 21:47:05 2015 +0200 @@ -73,8 +73,18 @@ session.privileges = ent_priv end +function on_presence(event) + -- Permission are already checked at this point, + -- we only advertise them to the entity + local session, stanza = event.origin, event.stanza; + if session.privileges then + advertise_perm(session.full_jid, session.privileges) + end +end + module:hook('authentication-success', on_auth) module:hook('component-authenticated', on_auth) +module:hook('presence/initial', on_presence) --> roster permission <--