diff options
author | Kim Alvefur <zash@zash.se> | 2024-11-08 02:11:00 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-11-08 02:11:00 +0100 |
commit | 9005d35b4850dcde6d8fb4cba713f50a641a5b88 (patch) | |
tree | 476bb4bebfb4cf984b896077b5dc897454f3e0cb /spec | |
parent | ef342f9734a4141b92b280040fd6180f4a30a5ae (diff) | |
download | prosody-9005d35b4850dcde6d8fb4cba713f50a641a5b88.tar.gz prosody-9005d35b4850dcde6d8fb4cba713f50a641a5b88.zip |
util.pubsub: Add method returning subset of config as metadata
Allows granting read only access to other sets of users using a separate
access control capability, which makes sense as some properties may be
intended to be public but read-only.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_pubsub_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua index f968fb97..a03ffa64 100644 --- a/spec/util_pubsub_spec.lua +++ b/spec/util_pubsub_spec.lua @@ -605,4 +605,14 @@ describe("util.pubsub", function () end); end) + + describe("metadata", function() + it("works", function() + local service = pubsub.new { metadata_subset = { "title" } }; + assert.truthy(service:create("node", true, { title = "Hello", secret = "hidden" })) + local ok, meta = service:get_node_metadata("node", "nobody"); + assert.truthy(ok, meta); + assert.same({ title = "Hello" }, meta); + end) + end); end); |