aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/mod_pubsub.lua
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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-071-0/+1
| | | | | This allows overriding it in cases where it is not equal to module.host, like say, in mod_pep
* 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: 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?
* 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-251-0/+1
|
* mod_pubsub,mod_pep: Support "max" as 'pubsub#max_items'Kim Alvefur2021-06-091-3/+11
| | | | | | Fixes #1643 API change: The argument to archive_itemstore() changes type to integer
* 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-051-5/+6
|\ \ | |/ |/|
| * mod_pubsub: Comment on itemstore typeKim Alvefur2020-10-251-1/+1
| |
| * Merge 0.11->trunkKim Alvefur2020-02-271-1/+1
| |\
| * | 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.
| * | Merge 0.11->trunkKim Alvefur2019-02-221-1/+3
| |\ \
| * | | 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
* | | mod_pubsub, mod_pep: Ensure correct number of children of <item/> (fixes #1496)Kim Alvefur2020-02-271-1/+1
| |/ |/|
* | mod_pubsub: Simplify configuration for node data (see #1302)Kim Alvefur2019-02-221-1/+3
|/
* pubsub: Set pubsub#title as name attribute in disco#items (fixes #1226)Kim Alvefur2018-10-301-1/+1
|
* mod_pubsub: Fix summary generation for Atom entries to use the correct fieldKim Alvefur2018-08-311-1/+1
|
* mod_pubsub: Add support for thin notifications (without the full payload)Kim Alvefur2018-08-161-0/+3
|
* mod_pubsub: Only attach publisher on normal "item" broadcastsKim Alvefur2018-08-161-2/+4
| | | | The 'publisher' is only on <item> in the schema.
* mod_pubsub: Prepare to support turning notifications off for each kind of ↵Kim Alvefur2018-08-161-0/+5
| | | | broadcast
* util.pubsub: Pass "retract" as the type of such broadcastsKim Alvefur2018-08-161-0/+4
| | | | | | | | This moves some XEP-0060 awkwardness out of util.pubsub and into mod_pubsub A retraction is broadcast in an <items> container, whereas most other kinds of broadcasts are in a container with a name matching the 'kind' attribute.
* mod_pubsub, mod_pep, util.pubsub: Move capability definitions into ↵Matthew Wild2018-08-081-78/+0
| | | | util.pubsub to avoid duplication
* mod_pubsub, mod_pep: The "restricted" affiliation should be allowed to be ↵Kim Alvefur2018-08-061-0/+4
| | | | | | unsubscribed but nothing else Can't revoke their subscriptions on change of access model otherwise
* mod_pubsub: Add 'get_configuration' capability to relevant affiliationsKim Alvefur2018-08-051-0/+2
| | | | | | Like ca5228a7d907 did for mod_pep Thanks pep.
* mod_pubsub: Add a public method for retrieving the service objectKim Alvefur2018-08-051-0/+4
| | | | There is already a set_service()
* mod_pubsub: Add comment to document nodestore/itemstore methodsMatthew Wild2018-08-041-0/+14
|
* mod_pubsub: Restrict access model to 'whitelist' and 'open'Kim Alvefur2018-08-041-0/+3
| | | | | 'presence' and 'roster' makes more sense for PEP 'auithorize' needs additional code for authorization flow
* mod_pubsub: Add configurable maximum on number of itemsKim Alvefur2018-08-041-0/+9
| | | | Like aefb96a52f5f
* mod_pubsub: Make generation of notification body into an event to allow ↵Kim Alvefur2018-07-141-11/+17
| | | | extensibility
* mod_pubsub: Skip checks for adding body if no body generatedKim Alvefur2018-07-141-1/+1
|
* mod_pubsub: Remove unneeded stanza API callKim Alvefur2018-07-141-1/+0
|
* mod_pubsub: Move include_body option into subscription optionsKim Alvefur2018-07-141-6/+11
|
* mod_pubsub: Move service discovery to pubsub.lib to allow reuseKim Alvefur2018-07-061-17/+2
|
* mod_pubsub: Remove feature flag for data persistence since node config is ↵Kim Alvefur2018-07-011-9/+0
| | | | now persistent
* mod_pubsub: Handle optional item (thanks jonasw)Kim Alvefur2018-06-281-2/+5
| | | | | The ‘item’ argument is optional, so it needs to handle it not being included, or util.stanza will throw an error in add_child
* mod_pubsub: Add support for generation of a plain text <body> from Atom payloadsKim Alvefur2018-05-211-0/+20
| | | | See https://xmpp.org/extensions/xep-0060.html#impl-body