Software /
code /
prosody-modules
Annotate
mod_muc_members_json/README.md @ 5729:655f90b149a4
mod_audit: Pass IP address in string form
Passing an util.ip object to :text_tag() would be an error.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 13 Nov 2023 12:02:54 +0100 |
parent | 5716:6696075e26e2 |
rev | line source |
---|---|
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 --- |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 labels: |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 - 'Stage-Beta' |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 summary: 'Import MUC membership info from a JSON file' |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 ... |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 Introduction |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 ============ |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 This module allows you to import MUC membership information from an external |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 URL in JSON format. |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 Details |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 ======= |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 If you have an organization or community and lots of members and/or channels, |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 it can be frustrating to manage MUC affiliations manually. This module will |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 fetch a JSON file from a configured URL, and use that to automatically set the |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 MUC affiliations. |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 It also supports hats/badges. |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 Configuration |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 ============= |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 Add the module to the MUC host (not the global modules\_enabled): |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 Component "conference.example.com" "muc" |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 modules_enabled = { "muc_members_json" } |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 You can define (globally or per-MUC component) the following options: |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 Name Description |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 --------------------- -------------------------------------------------- |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 muc_members_json_url The URL to the JSON file describing memberships |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 muc_members_json_mucs The MUCs to manage, and their associated configuration |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 The `muc_members_json_mucs` setting determines which rooms will be managed by |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 the plugin, and how to map roles to hats (if desired). |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 |
5716
6696075e26e2
mod_muc_members_json: Fix typo in example and set correct syntax highlighter
Matthew Wild <mwild1@gmail.com>
parents:
5715
diff
changeset
|
41 ``` lua |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 muc_members_json_mucs = { |
5716
6696075e26e2
mod_muc_members_json: Fix typo in example and set correct syntax highlighter
Matthew Wild <mwild1@gmail.com>
parents:
5715
diff
changeset
|
43 -- This configures hats for the myroom@<this MUC host> MUC |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 myroom = { |
5715
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
45 -- The optional field 'member_hat' defines a hat that will be |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
46 -- added to any user that is listed in the members JSON |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
47 -- (regardless of what roles they have, if any) |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 member_hat = { |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 id = "urn:uuid:6a1b143a-1c5c-11ee-80aa-4ff1ce4867dc"; |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
50 title = "Cool Member"; |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
51 }; |
5715
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
52 -- The optional field 'team_hats' defines one or more hats |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
53 -- that will be assigned to users that have the specified |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
54 -- roles in the JSON. |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
55 team_hats = { |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
56 janitor = { |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
57 id = "urn:uuid:ec32f550-7d5f-11ee-81ee-6b139cac3bf6"; |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
58 title = "Janitor"; |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
59 } |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
60 } |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
61 }; |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
62 } |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
63 ``` |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
64 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
65 JSON format |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
66 =========== |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
67 |
5678
1cae6133e315
mod_muc_members_json: Demonstrate support for more than one JID per list
Kim Alvefur <zash@zash.se>
parents:
5677
diff
changeset
|
68 ``` json |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
69 { |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
70 "members": [ |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
71 { |
5678
1cae6133e315
mod_muc_members_json: Demonstrate support for more than one JID per list
Kim Alvefur <zash@zash.se>
parents:
5677
diff
changeset
|
72 "jids": [ |
1cae6133e315
mod_muc_members_json: Demonstrate support for more than one JID per list
Kim Alvefur <zash@zash.se>
parents:
5677
diff
changeset
|
73 "user@example.com", |
1cae6133e315
mod_muc_members_json: Demonstrate support for more than one JID per list
Kim Alvefur <zash@zash.se>
parents:
5677
diff
changeset
|
74 "user2@example.com" |
1cae6133e315
mod_muc_members_json: Demonstrate support for more than one JID per list
Kim Alvefur <zash@zash.se>
parents:
5677
diff
changeset
|
75 ] |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
76 }, |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
77 { |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
78 "jids": ["user3@example.com"], |
5677
31e56562f9bd
mod_muc_members_json: Fix invalid JSON in README
Kim Alvefur <zash@zash.se>
parents:
5586
diff
changeset
|
79 "roles": ["janitor"] |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
80 } |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
81 ] |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
82 } |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
83 ``` |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
84 |
5715
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
85 The JSON format must be an object with a `members` array. |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
86 |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
87 Each member must have a `jids` field, and optionally a `roles` field (both are |
aa94d5bb6b10
mod_muc_members_json: Expand example config and docs for clarity
Matthew Wild <mwild1@gmail.com>
parents:
5678
diff
changeset
|
88 arrays of strings). |
5586
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
89 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
90 Compatibility |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
91 ============= |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
92 |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
93 ------- ------------------ |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
94 trunk Works |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
95 0.12 Works |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
96 ------- ------------------ |
30b9f78b5058
mod_muc_members_json: New module to import MUC membership from a JSON URL
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
97 |