public Affiliation getAffiliation(@Nonnull final JID userAddress) {
        final JID bareJID = userAddress.asBareJID();

        if (mucService.isSysadmin(bareJID)) {
            // The user is a system administrator of the MUC service. Treat him as an owner, although he won't appear in the list of owners.
            Log.debug( "User '{}' is a sysadmin. Treat as owner.", userAddress);
            return Affiliation.owner;
        }

        if (owners.includes(bareJID)) {
            return Affiliation.owner;
        }
        else if (admins.includes(bareJID)) {
            return Affiliation.admin;
        }
        // explicit outcast status has higher precedence than member status
        else if (outcasts.includes(bareJID)) {
            return Affiliation.outcast;
        }
        else if (members.includesKey(bareJID)) {
            return Affiliation.member;
        }
        return Affiliation.none;
    }
Returns the affiliation state of the user in the room. Possible affiliations are
MUCOccupant.OWNER, MUCOccupant.ADMINISTRATOR, MUCOccupant.MEMBER, MUCOccupant.OUTCAST and MUCOccupant.NONE.

Note: Prerequisite - A lock must already be obtained before sending this message.

@param userAddress The (real) JID of the user of which you'd like to obtain his affiliation.
@return the affiliation state of the user in the room.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/MUCRoom.java