✨(backend) let an operator forbid a room access level - #1619
Conversation
Add RESOURCE_ALLOWED_ACCESS_LEVELS so instance operators can limit which room access levels users may set, including room owners and admins. Enforce the allow-list through the room serializer on create and update, and fail fast when RESOURCE_DEFAULT_ACCESS_LEVEL is outside the allowed set to avoid invalid default-room creation.
Only show the access levels the instance allows in the room access picker, instead of always listing all of them.
| "access_level" not in serializer.validated_data | ||
| and user.default_room_access_level not in (None, "") | ||
| and user.default_room_access_level | ||
| in settings.RESOURCE_ALLOWED_ACCESS_LEVELS |
There was a problem hiding this comment.
This value goes straight into save(), where no serializer check sees it. Without the line, a default saved before the list narrowed still creates rooms at a forbidden level.
The list was checked in one serializer, so the external room API and the user's saved default still created rooms the instance forbids, and a meeting created before the list narrowed kept its level. Every path checks it now, both defaults are checked at boot, and a meeting the list no longer holds is entered at the next stricter level it does allow. The row keeps its own value.
The room settings panel filtered the levels while the SDK popup and the room defaults tab offered every one, each from its own copy of the list. One hook builds it for the three, and the panel shows the level the meeting runs at when the instance no longer allows the saved one.
2d6a0c8 to
18c7420
Compare
The panel selected the enforced level for them, so a host whose saved level was dropped saw a settled picker and no reason to touch it. Nothing is selected now, and the message names what the meeting runs as.
A room the instance no longer allows was entered one level stricter and said nothing, so its owner had no reason to move it. The room now carries access_level_needs_choice, which the settings panel reads to clear the picker and ask. A level this version does not know at all falls to the strictest allowed instead of raising on every read of the room.
The ordering was stated twice, and the panel's comment explained the backend rule rather than the line under it.
| # front of it, so a forbidden level cannot be enforced on one. | ||
| if ( | ||
| not settings.ALLOW_UNREGISTERED_ROOMS | ||
| or RoomAccessLevel.PUBLIC not in settings.RESOURCE_ALLOWED_ACCESS_LEVELS |
There was a problem hiding this comment.
ALLOW_UNREGISTERED_ROOMS mints a meeting for any slug, with no row behind it. There is nowhere to put a level, and no lobby stands in front of it, so it is an open meeting or it is nothing. Without this, an operator who forbids open meetings still hands one to anyone who types a URL.
PR Summary by QodoAllow operators to restrict which room access levels can be selected
AI Description
Diagram
High-Level Assessment
Files changed (31)
|
Code Review by Qodo
1.
|
|



Takes over #1444, its author handed it on.
Fixes #1076
Problem
A room owner can set any meeting to open access, whatever default the operator picked.
The operator has no way to forbid a level outright.
Design
The setting
RESOURCE_ALLOWED_ACCESS_LEVELSlists the levels a room may be set to. It defaults to all three, so an upgrade changes nothing.At boot
A deployment whose settings contradict the list does not start, rather than starting and ignoring one of them.
Unregistered meetings
ALLOW_UNREGISTERED_ROOMShands a meeting to anyone typing a URL, with no record behind it and no lobby in front of it. There is nowhere to store a level for one, so while the list forbids open meetings those URLs answer 404 instead.Existing meetings
The room settings panel offers only what the list holds. A meeting created before the operator narrowed the list is entered at the next stricter level the list does allow. Its host sees an empty picker and a line naming what the meeting runs as, so the choice is theirs to make. The row keeps its own value, so widening the list again restores it.
The first two commits are phanky1's, cherry-picked unchanged.
The host settings panel of an open meeting, filmed on an instance that allows all three levels, then on the same instance allowing trusted and restricted, with the room untouched in the database between the two:
Glossary
operator: whoever runs the instance and sets its environment variables.
room owner, administrator: whoever can open a meeting's settings and change who may join.
open, trusted, restricted: the three access levels, in that order anyone with the link, anyone signed in, invited people only. Everyone else asks to join.
the allow-list:
RESOURCE_ALLOWED_ACCESS_LEVELS, the setting this pull request adds.