Software /
code /
prosody
Comparison
plugins/adhoc/adhoc.lib.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 | 8472:d88dc6827675 |
child | 11351:6b541d3c4c1b |
comparison
equal
deleted
inserted
replaced
10564:3098eac31139 | 10565:421b2f8369fd |
---|---|
19 | 19 |
20 return cmd; | 20 return cmd; |
21 end | 21 end |
22 | 22 |
23 function _M.new(name, node, handler, permission) | 23 function _M.new(name, node, handler, permission) |
24 return { name = name, node = node, handler = handler, cmdtag = _cmdtag, permission = (permission or "user") }; | 24 if not permission then |
25 error "adhoc.new() expects a permission argument, none given" | |
26 end | |
27 if permission == "user" then | |
28 error "the permission mode 'user' has been renamed 'any', please update your code" | |
29 end | |
30 return { name = name, node = node, handler = handler, cmdtag = _cmdtag, permission = permission }; | |
25 end | 31 end |
26 | 32 |
27 function _M.handle_cmd(command, origin, stanza) | 33 function _M.handle_cmd(command, origin, stanza) |
28 local cmdtag = stanza.tags[1] | 34 local cmdtag = stanza.tags[1] |
29 local sessionid = cmdtag.attr.sessionid or uuid.generate(); | 35 local sessionid = cmdtag.attr.sessionid or uuid.generate(); |