private NodeAffiliate addAffiliation(JID jid, NodeAffiliate.Affiliation affiliation) {
        getLogger().trace("Add '{}' as {}", jid, affiliation);
        boolean created = false;
        // Get the current affiliation of the specified JID
        NodeAffiliate affiliate = getAffiliate(jid);
        // Check if the user already has the same affiliation
        if (affiliate != null && affiliation == affiliate.getAffiliation()) {
            getLogger().trace("Do nothing since the user already has the expected affiliation");
            return affiliate;
        }
        else if (affiliate != null) {
            getLogger().trace("Update existing affiliation of type '{}' with new affiliation type", affiliate.getAffiliation());
            affiliate.setAffiliation(affiliation);
        }
        else {
            getLogger().trace("User did not have any affiliation with the node so create a new one");
            affiliate = new NodeAffiliate(this, jid);
            affiliate.setAffiliation(affiliation);
            addAffiliate(affiliate);
            created = true;
        }

        if (savedToDB) {
            getLogger().trace("Add or update the affiliate in the database");
            final PubSubPersistenceProvider persistenceProvider = XMPPServer.getInstance().getPubSubModule().getPersistenceProvider();
            if ( created ) {
                persistenceProvider.createAffiliation(this, affiliate);
            } else {
                persistenceProvider.updateAffiliation(this, affiliate);
            }
        }
        
        getLogger().trace("Update the other cluster members with the new affiliation");
        CacheFactory.doClusterTask(new AffiliationTask(this, jid, affiliation));

        return affiliate;
    }
Removes the banning to subscribe to the node for the specified entity.

@param jid the JID of the user that is no longer an outcast.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/Node.java