mod_pubsub

Implements a XEP-0060 pubsub service.

Usage

Load as a component:

Component "pubsub.example.com" "pubsub"

Configuration

Various options are supported:

admins = {}

Add additional admins for this component (global admins are automatically admins)

default_admin_affiliation = "owner"

The default affiliation of admins to nodes

autocreate_on_subscribe = false

Whether to automatically create non-existent nodes when someone subscribes

autocreate_on_publish = false

Whether to automatically create non-existent nodes when someone publishes

pubsub_max_items = 256

Limit on how many items nodes can be configured to store.

pubsub_summary_templates = {
    ["http://www.w3.org/2005/Atom"] = "{summary|or{{author/name|and{{author/name} posted }}{title}}}";
}

Templates used to generate plain text version of notifications from payloads, using util.xtemplate. Available starting with 0.12.0.

Permissions

From Prosody 13.0+, two permissions are defined in mod_pubsub:

pubsub:service-admin
This permission allows being given a default affiliation set by default_admin_affiliation, defaulting to owner.
pubsub:create-node
This permission allows creating new nodes. The creator becomes owner of the new node.

Common permission configurations

If you are using the default authorization provider (mod_authz_internal), the following sections explain how to configure the pubsub permissions for different scenarios.

Parent VirtualHost

User accounts on the parent VirtualHost will default to the prosody:registered role on a component. Therefore, to grant everyone on the parent VirtualHost permission to create nodes, add the pubsub:create-node permission on the Component as follows:

Component "pubsub.example.com" "pubsub"
  add_permissions = {
      ["prosody:registered"] = { "pubsub:create-node" }
  }

Everyone on the server

To grant everyone on the same Prosody instance permission to create nodes, tell mod_authz_internal to assign them the prosody:registered role (by using the server_user_role option) and then configure the pubsub:create-node permission for this role as above.

Component "pubsub.example.com" "pubsub"
  server_user_role = "prosody:guest"
  add_permissions = {
      ["prosody:registered"] = { "pubsub:create-node" }
  }

Completely open

To grant everyone on the entire XMPP federated network permission to create nodes, you can add the pubsub:create-node permission to the prosody:guest role:

Component "pubsub.example.com" "pubsub"
  add_permissions = {
      ["prosody:guest"] = { "pubsub:create-node" }
  }