Ian Paterson wrote:
Peter Saint-Andre wrote:
So we'd have something like this:

<iq from='juliet at capulet.com/balcony' type='set' id='foo'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/activity'>
      <item>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <relaxing>
            <partying/>
          </relaxing>
          <text xml:lang='en'>My nurse&apos;s birthday!</text>
        </activity>
      </item>
    </publish>
    <preconditions>
      <x xmlns='jabber:x:data' type='submit'>
        <field var='FORM_TYPE' type='hidden'>
          <value>http://jabber.org/protocol/pubsub#node_config</value>
        </field>
        <field var='pubsub#access_model'>
          <option><value>whitelist</value></option>
        </field>
      </x>
    </preconditions>
  </pubsub>
</iq>

If the node exists and the precondition is not met (in this case, if the
access model is something other than "whitelist"), then the publish
fails with a suitable error condition (probably <conflict/> along with
some pubsub-specific condition).

If the node exists and the precondition is met, then the publish succeeds.

If the node does not exist, then the service auto-creates the node with
default configuration in all respects except those specified in the
preconditions (in this case, the node would be created with an access
model of "whitelist") and the publish succeeds.

Correct?

Correct. +1

Thank you Ralph, Peter.

Wow! consensus on Personal Publishing! I'm off to celebrate :-) :-)

- Ian


Whether to autocreate or to return error saying node does not exist (item-not-found) - can this be an implementation detail ? That is, are clients expected to handle the error path too and explictly create ? We do not have auto create in pubsub iirc (not sure if pubsub was modified to support this) - so supporting this for pep will implictly mean supporting it for pubsub too (same namespace, etc).

But in general, preconditions are great way to assert access level for clients/nodes which require strict acl's.

Regards,
Mridul

PS : Hope this is not going back to the same path's earlier, just wanted to get it clarified.

Reply via email to