Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/plugins/adhoc/adhoc.lib.lua Tue Dec 24 00:49:43 2019 +0100 +++ b/plugins/adhoc/adhoc.lib.lua Fri Dec 20 22:47:34 2019 +0100 @@ -21,7 +21,13 @@ end function _M.new(name, node, handler, permission) - return { name = name, node = node, handler = handler, cmdtag = _cmdtag, permission = (permission or "user") }; + if not permission then + error "adhoc.new() expects a permission argument, none given" + end + if permission == "user" then + error "the permission mode 'user' has been renamed 'any', please update your code" + end + return { name = name, node = node, handler = handler, cmdtag = _cmdtag, permission = permission }; end function _M.handle_cmd(command, origin, stanza)