1 local is_admin
= require
"core.usermanager".is_admin
;
2 local t_remove
= table.remove;
4 local restricted_options
= module
:get_option_set("muc_config_restricted", {})._items
;
6 function handle_config_submit(event
)
7 local stanza
= event
.stanza
;
8 if is_admin(stanza
.attr
.from
, module
.host
) then return; end -- Don't restrict admins
9 local fields
= event
.fields
;
10 for option
in restricted_options
do
11 fields
[option
] = nil; -- Like it was never there
15 function handle_config_request(event
)
16 if is_admin(event
.actor
, module
.host
) then return; end -- Don't restrict admins
17 local form
= event
.form
;
18 for i
= #form
, 1, -1 do
19 if restricted_options
[form
[i
].name
] then
25 module
:hook("muc-config-submitted", handle_config_submit
);
26 module
:hook("muc-config-form", handle_config_request
);