Set whitelist JIDs for pubsub node

Hello all, I am wondering that is there any easy way for setting JIDs for pubsub node with AccessModel.whitelist.
There was same question but no one answered: PubSub and AccessModel
Do we have easy way for that ? I thought there should be a way to set whitelist JIDs when I create a new node, but actually not.
I think I have to send kind of following message to server to set JIDs as whitelist for a pubsub node:


< pubsub xmlns=‘http://jabber.org/protocol/pubsub#owner’>
< affiliations node=‘target_node’>
< affiliation jid=‘alloweduser1@openfire.company.com’ affiliation=‘none’/>
< affiliation jid=‘alloweduser2@openfire.company.com’ affiliation=‘none’/>
< /affiliations>
< /pubsub>
< /iq>

But I don’t know how can I send this message easily with smack API.
There is sendPubsubPacket() method in PubSubManager but the method is protected as privacy method.

I’m very happy if someone can help me, thank you !

Try Node.modifyAffiliationAsOwner(java.util.List<Affiliation> affiliations).

Hi, thank you !
I didn’t notice that the method was added to Node class.

I tried with modifyAffiliationAsOwner(), but I got an error from openfire server.
It seems that modifyAffiliationAsOwner() sends wrong XML message as following:


<iq to='pubsub.openfire.company.com' id='8Fnyd-43' type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
<affiliations> node='target_node'>
<affiliation xmlns='http://jabber.org/protocol/pubsub#owner' jid='alloweduser1@openfire.company.com' affiliation='member'/>
</affiliations>
</pubsub></iq>

It should be:

<iq to='pubsub.openfire.company.com' id='8Fnyd-43' type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
<affiliations node='target_node'>
<affiliation jid='alloweduser1@openfire.company.com' affiliation='member'/>
</affiliations>
</pubsub></iq>

I think modifyAffiliationAsOwner() method, especially AffiliationsExtension.java has bug.

Right, thanks for reporting. Created SMACK-789.

Thank you. Looking forward bug fixed version !

You don’t have to wait for a release, you can always use Smack’s snapshots: https://github.com/igniterealtime/Smack/wiki/How-to-use-Smack-snapshots

Hello,

I have found the exact same issue as reported above by Jpro.
Is this issue resolved yet?
I have tested by using latest maven version of smack - 4.2.3
found again the same issue.

Reference to latest smack maven dependency version - https://mvnrepository.com/artifact/org.igniterealtime.smack

Hi, above snapshot already seems to solve the problem.

A post was split to a new topic: PubSub Affiliation Modifications