Software /
code /
prosody
Comparison
plugins/adhoc/mod_adhoc.lua @ 10565:421b2f8369fd
mod_adhoc: Improve permission setting (fix #1482) BC
Rename 'user' permission mode to 'any' for clarity, too easily mistaken
for what the 'local_user' setting does.
It is also removed as a default and made a required argument.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 20 Dec 2019 22:47:34 +0100 |
parent | 10542:f1886a48a6d4 |
child | 11209:f6661fac7e9a |
comparison
equal
deleted
inserted
replaced
10564:3098eac31139 | 10565:421b2f8369fd |
---|---|
24 local hostname = jid_host(from); | 24 local hostname = jid_host(from); |
25 local command = commands[node]; | 25 local command = commands[node]; |
26 if (command.permission == "admin" and privileged) | 26 if (command.permission == "admin" and privileged) |
27 or (command.permission == "global_admin" and global_admin) | 27 or (command.permission == "global_admin" and global_admin) |
28 or (command.permission == "local_user" and hostname == module.host) | 28 or (command.permission == "local_user" and hostname == module.host) |
29 or (command.permission == "user") then | 29 or (command.permission == "any") then |
30 reply:tag("identity", { name = command.name, | 30 reply:tag("identity", { name = command.name, |
31 category = "automation", type = "command-node" }):up(); | 31 category = "automation", type = "command-node" }):up(); |
32 reply:tag("feature", { var = xmlns_cmd }):up(); | 32 reply:tag("feature", { var = xmlns_cmd }):up(); |
33 reply:tag("feature", { var = "jabber:x:data" }):up(); | 33 reply:tag("feature", { var = "jabber:x:data" }):up(); |
34 event.exists = true; | 34 event.exists = true; |
55 local hostname = jid_host(from); | 55 local hostname = jid_host(from); |
56 for node, command in it.sorted_pairs(commands) do | 56 for node, command in it.sorted_pairs(commands) do |
57 if (command.permission == "admin" and admin) | 57 if (command.permission == "admin" and admin) |
58 or (command.permission == "global_admin" and global_admin) | 58 or (command.permission == "global_admin" and global_admin) |
59 or (command.permission == "local_user" and hostname == module.host) | 59 or (command.permission == "local_user" and hostname == module.host) |
60 or (command.permission == "user") then | 60 or (command.permission == "any") then |
61 reply:tag("item", { name = command.name, | 61 reply:tag("item", { name = command.name, |
62 node = node, jid = module:get_host() }); | 62 node = node, jid = module:get_host() }); |
63 reply:up(); | 63 reply:up(); |
64 end | 64 end |
65 end | 65 end |