diff options
author | Matthew Wild <mwild1@gmail.com> | 2022-08-22 13:53:35 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2022-08-22 13:53:35 +0100 |
commit | e4ed9a570ab61ef45ca0e63dfd6d230e26812749 (patch) | |
tree | 361af05ddf1d012f9ce849528d36cfa83a0715ba /plugins/muc/hidden.lib.lua | |
parent | b79cb49bfba1d64dda54cf7243154624c53b5fb9 (diff) | |
parent | 227f6c033697210a54f671f5b9128cde8699fdcd (diff) | |
download | prosody-e4ed9a570ab61ef45ca0e63dfd6d230e26812749.tar.gz prosody-e4ed9a570ab61ef45ca0e63dfd6d230e26812749.zip |
Merge role-auth->trunk
Diffstat (limited to 'plugins/muc/hidden.lib.lua')
-rw-r--r-- | plugins/muc/hidden.lib.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/muc/hidden.lib.lua b/plugins/muc/hidden.lib.lua index 153df21a..087fa102 100644 --- a/plugins/muc/hidden.lib.lua +++ b/plugins/muc/hidden.lib.lua @@ -8,7 +8,7 @@ -- local restrict_public = not module:get_option_boolean("muc_room_allow_public", true); -local um_is_admin = require "core.usermanager".is_admin; +module:default_permission(restrict_public and "prosody:admin" or "prosody:user", ":create-public-room"); local function get_hidden(room) return room._data.hidden; @@ -22,8 +22,8 @@ local function set_hidden(room, hidden) end module:hook("muc-config-form", function(event) - if restrict_public and not um_is_admin(event.actor, module.host) then - -- Don't show option if public rooms are restricted and user is not admin of this host + if not module:may(":create-public-room", event.actor) then + -- Hide config option if this user is not allowed to create public rooms return; end table.insert(event.form, { @@ -36,7 +36,7 @@ module:hook("muc-config-form", function(event) end, 100-9); module:hook("muc-config-submitted/muc#roomconfig_publicroom", function(event) - if restrict_public and not um_is_admin(event.actor, module.host) then + if not module:may(":create-public-room", event.actor) then return; -- Not allowed end if set_hidden(event.room, not event.value) then |