Setting affiliation on Prosody

Hi there,

we’d like to set affiliation on prosody for an user joining the conference. Basically we’re doing something like this:

module:hook("muc-occupant-joined", function(event)
    local room, occupant, origin =, event.occupant, event.origin;
    room:set_affiliation(true, occupant.bare_jid, affiliation);
    occupant.role = role;

Once we do this, the role exposed through lib-jitsi-meet in the calls to JitsiConference.getRole() and JitsiConference.isModerator() does not match the role set above. For example, let’s say we statically set the affiliation to "none" and role to "participant", then the behavior in lib-jitsi-meet is as follows:

  • JitsiConference.getRole() returns "moderator"
  • JitsiConference.isModerator() returns true

What is the relationship between the affiliation and the role? Is it possible to set both in an event handler on Prosody? The reason why we’re doing this in Prosody is that we want to verify the necessary ACL before changing the affiliation and role of an user.


Thanks so much, this really helped!

1 Like