Software /
code /
prosody
Diff
plugins/muc/hidden.lib.lua @ 12674:72f431b4dc2c
Merge role-auth->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 22 Aug 2022 13:53:35 +0100 |
parent | 12642:9061f9621330 |
child | 13170:082c7d856e61 |
line wrap: on
line diff
--- a/plugins/muc/hidden.lib.lua Fri Aug 19 14:24:31 2022 +0200 +++ b/plugins/muc/hidden.lib.lua Mon Aug 22 13:53:35 2022 +0100 @@ -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 @@ 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 @@ 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