aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub
Commit message (Collapse)AuthorAgeFilesLines
* mod_pubsub/pubsub.lib: Fix accidental name/var swap (thanks scansion)Matthew Wild2023-03-221-2/+2
|
* mod_pubsub, mod_pep: Support per-node configurable inclusion of publisherMatthew Wild2023-03-222-4/+29
| | | | | | | | | | | | | | | | | This matches ejabberd's behaviour, using the 'pubsub#itemreply' config option. Although the current definition of this option in the specification is not as clear as it could be, I think matching what existing deployments do is the best option to resolve the ambiguity and reduce fragmentation. We should update the spec to be clearer about how to use and interpret this option. The 'expose_publisher' option for mod_pubsub is now an override (always expose or never expose). If unset, it will use the per-node config (which defaults to not exposing). Thanks to Link Mauve, edhelas and goffi for sparking this feature.
* Switch to a new role-based authorization framework, removing is_admin()Matthew Wild2022-06-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We began moving away from simple "is this user an admin?" permission checks before 0.12, with the introduction of mod_authz_internal and the ability to dynamically change the roles of individual users. The approach in 0.12 still had various limitations however, and apart from the introduction of roles other than "admin" and the ability to pull that info from storage, not much actually changed. This new framework shakes things up a lot, though aims to maintain the same functionality and behaviour on the surface for a default Prosody configuration. That is, if you don't take advantage of any of the new features, you shouldn't notice any change. The biggest change visible to developers is that usermanager.is_admin() (and the auth provider is_admin() method) have been removed. Gone. Completely. Permission checks should now be performed using a new module API method: module:may(action_name, context) This method accepts an action name, followed by either a JID (string) or (preferably) a table containing 'origin'/'session' and 'stanza' fields (e.g. the standard object passed to most events). It will return true if the action should be permitted, or false/nil otherwise. Modules should no longer perform permission checks based on the role name. E.g. a lot of code previously checked if the user's role was prosody:admin before permitting some action. Since many roles might now exist with similar permissions, and the permissions of prosody:admin may be redefined dynamically, it is no longer suitable to use this method for permission checks. Use module:may(). If you start an action name with ':' (recommended) then the current module's name will automatically be used as a prefix. To define a new permission, use the new module API: module:default_permission(role_name, action_name) module:default_permissions(role_name, { action_name[, action_name...] }) This grants the specified role permission to execute the named action(s) by default. This may be overridden via other mechanisms external to your module. The built-in roles that developers should use are: - prosody:user (normal user) - prosody:admin (host admin) - prosody:operator (global admin) The new prosody:operator role is intended for server-wide actions (such as shutting down Prosody). Finally, all usage of is_admin() in modules has been fixed by this commit. Some of these changes were trickier than others, but no change is expected to break existing deployments. EXCEPT: mod_auth_ldap no longer supports the ldap_admin_filter option. It's very possible nobody is using this, but if someone is then we can later update it to pull roles from LDAP somehow.
* util.stanza: Add method for extracting a single attribute valueKim Alvefur2022-08-171-2/+1
| | | | | | | | | Sometimes you only care about a single attribute, but the child tag itself may be optional, leading to needing `tag and tag.attr.foo` or `stanza:find("tag@foo")`. The `:find()` method is fairly complex, so avoiding it for this kind of simpler use case is a win.
* compat: Remove handling of Lua 5.1 location of 'unpack' functionKim Alvefur2022-07-111-1/+1
|
* mod_pubsub: Don't attempt to use server actor as publisher (fixes #1723)Matthew Wild2022-03-211-1/+1
|
* mod_pubsub: Allow configuring summary templatesKim Alvefur2022-01-241-6/+11
| | | | | Enables generation of summaries for more than Atom without additional modules.
* mod_pubsub: Use the util.xtemplate to render Atom summaryKim Alvefur2022-01-241-9/+3
|
* mod_pubsub: Use the 'pubsub#type' setting to pick summary generatorKim Alvefur2022-01-241-1/+2
| | | | | | Allows using different ones even if multiple semantically different formats share the same root element xmlns, e.g. generic Atom and XEP-0277 entries.
* util.pubsub: Fix item store resize to "max"Kim Alvefur2022-01-061-0/+1
| | | | | Previously this would end up passing the "max" directly to the underlying storage.
* mod_pubsub: Allow specifying the JID of the pubsub serviceKim Alvefur2021-12-072-1/+2
| | | | | This allows overriding it in cases where it is not equal to module.host, like say, in mod_pep
* mod_pubsub: Fix traceback in disco of non-existent node (thanks Martin)Kim Alvefur2021-11-131-2/+6
| | | | | | | In this case `ret` is a table not containing the node, which makes pubsub_error_reply() try to get an error template with that `ret` table as index, which returns a `nil` then passed to table.unpack, which in turn throws the error.
* mod_pubsub: Return proper errors for disco queries on nodesKim Alvefur2021-11-011-2/+4
| | | | | Previously this would return item-not-found, even when you could see the node in disco#items.
* mod_pubsub,mod_pep: Advertise maximum number of items via XEP-0122Kim Alvefur2021-10-201-0/+7
| | | | | | Clients would generally be using the "max" symbol instead of discovering this, but this also gets us validation and earlier rejection of out of bounds values.
* mod_pubsub: Prevent max_items from being set to zeroKim Alvefur2021-10-201-0/+1
| | | | | | | Disable persistence instead if no items should be persisted. XEP-0060 is not entirely clear on what either of those option really mean.
* mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436Kim Alvefur2021-10-191-0/+16
| | | | | | | | Default left as 'never' in mod_pubsub to preserve the previous behavior. Unclear if this is desirable, but can always be changed later. In mod_pep this allows turning off the automatic resending of most recent item.
* mod_pubsub: Advertise support for 'max' as value for max_itemsKim Alvefur2021-09-151-0/+4
| | | | Ref #1643
* mod_pubsub/pubsub.lib: Export config forms for use by other modulesMatthew Wild2021-09-111-0/+3
| | | | In this case I need them for 227 import/export.
* mod_pubsub: Move reversal of item order in <items>Kim Alvefur2021-09-051-3/+9
| | | | | | | | | | | | Examples in XEP-0060 suggest that items should be listed in chronological order, but we get them from the archive in reverse order. However when requesting specific items by id the results keep that order and we don't want to flip it again. At some point it would likely be best to use the archive API directly instead of this util.cache-compatible wrapper.
* mod_pubsub: Add support for limiting result size #1608Kim Alvefur2021-09-051-1/+5
|
* mod_pubsub: Update callbacks on reload to more completely refresh configKim Alvefur2021-07-291-0/+8
| | | | | | | | | This would also release any resources held via references from these callbacks. I'm not sure why we don't just re-new() the whole thing. Related to #1382
* mod_pubsub: Update configuration on reload (fixes #1382)Kim Alvefur2021-07-251-0/+3
| | | | | | Because of the way the previous pubsub service is carried access module reloads, it would retain the configuration options with their previous values from when the service was first created.
* mod_pubsub: Silence warning about 'service' as argument [luacheck]Kim Alvefur2021-07-251-1/+1
| | | | | Maybe the 'service' in the outer scope should be moved down to minimize overlap with other functions that receive the same service as argument?
* util.pubsub: Signal that 'persistent-items' is unsupported when disabledKim Alvefur2021-07-221-0/+1
| | | | | | XEP-0060 says that this the way to indicate that 'persistent-items' is unsupported, but doesn't explicitly say if it being disabled in the node configuration also counts as unsupported.
* mod_pubsub: Explicitly enable persistence by default to preserve behaviorKim Alvefur2021-07-211-0/+3
| | | | | | Since nodes were always persistent according to the XEP-0060 definition. Whether data is stored in memory or on disk was not what this setting was meant for.
* mod_pubsub: Remove publisher field when not exposing publisherKim Alvefur2021-07-251-1/+3
| | | | | The publisher is already there on the item when the broadcaster gets it, so it needs to do the opposite thing.
* mod_pubsub: Normalize 'publisher' JIDKim Alvefur2021-07-251-2/+2
| | | | | | | | | | | | | All the XEP-0060 examples have the publisher attribute set to a bare JID, but the text does allow it to be the full JID. Since mod_pubsub is more likely used for open nodes that anyone can subscribe to it makes sense to not leak the full JIDs. This is also disabled by defaults. In mod_pep on the other hand it might make sense to have the full JID since that data is more likely to be broadcast to contacts which are already somewhat trusted.
* mod_pubsub: Respect 'expose publisher' setting in item retrievalKim Alvefur2021-07-252-1/+9
|
* mod_pubsub: Fix inclusion of publisher (fixes #1399)Kim Alvefur2019-05-011-2/+5
|
* mod_pubsub,mod_pep: Support "max" as 'pubsub#max_items'Kim Alvefur2021-06-092-7/+14
| | | | | | Fixes #1643 API change: The argument to archive_itemstore() changes type to integer
* mod_pubsub: Include <pubsub> with unsubscribe replyKim Alvefur2021-03-151-1/+7
| | | | | | | | | XEP-0060 6.2.2 This is a MAY but it makes it nice and symmetric with the subscription response. Reduces the need to remember which node you unsubscribed from. Explicit > implicit etc.
* Merge 0.11->trunkKim Alvefur2020-11-061-1/+1
|\
| * mod_pubsub: Fix notification stanza type setting (fixes #1605)Kim Alvefur2020-11-061-1/+1
| |
* | Merge 0.11->trunkKim Alvefur2020-11-052-18/+28
|\ \ | |/ |/|
| * mod_pubsub: Comment on itemstore typeKim Alvefur2020-10-251-1/+1
| |
| * mod_pubsub: Clarify kind of item store createdKim Alvefur2020-10-251-1/+1
| | | | | | | | | | Planning to make this configurable, so good to distinguish it from future backends.
| * mod_pubsub: Don't set store as metatableKim Alvefur2020-10-251-1/+1
| | | | | | | | | | 'archive' is not a metatable here, so this has no effect. Remove since apparently nothing depends on this.
| * Merge 0.11->trunkKim Alvefur2020-02-271-1/+1
| |\
| * | mod_pubsub: Ignore an unused variable [luacheck]Kim Alvefur2019-12-231-0/+1
| | |
| * | util.pubsub, pubsub.lib and tests: Add text to precondition-not-met error ↵Matthew Wild2019-10-271-0/+4
| | | | | | | | | | | | (fixes #1455)
| * | mod_pubsub: Remove the unwanted check for @notify on <purge/>.Emmanuel Gil Peyrot2019-09-281-3/+2
| | | | | | | | | | | | | | | | | | This most likely was copied from the handling of <retract/>, where it actually is required by the spec (XEP-0060 §7.2.2.1), but this attribute doesn’t exist for purge.
| * | mod_pubsub: Eliminate dead codeKim Alvefur2019-07-251-8/+3
| | | | | | | | | | | | `data` is a stanza and always truthy
| * | mod_pubsub: Move a comment to where it makes senseKim Alvefur2019-07-101-1/+1
| | | | | | | | | | | | This code has moved but the comment did not follow it.
| * | mod_pubsub: Expose pubsub#access_model and pubsub#publish_model (fixes #1387)Kim Alvefur2019-07-061-0/+10
| | |
| * | Merge 0.11->trunkKim Alvefur2019-02-221-1/+3
| |\ \
| * \ \ Merge 0.11->trunkKim Alvefur2019-01-281-3/+9
| |\ \ \
| * | | | mod_pubsub: Split line in config check to improve readabilityKim Alvefur2018-12-231-1/+2
| | | | | | | | | | | | | | | | | | | | Also makes it easier to compare with mod_pep
| * | | | mod_pubsub: Change order of luacheck directives to match arguments they apply toKim Alvefur2018-12-231-1/+1
| | | | |
| * | | | mod_pubsub: Add semicolon (code style)Kim Alvefur2018-12-231-1/+1
| | | | |
* | | | | mod_pubsub: Lower priority of default <body> generatorKim Alvefur2020-11-051-1/+1
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | in order to avoid conflict with a handler at the default (0) priority, making it easier to write your own formatting in plugins. this follows the common pattern of default modules having lower priority