bigbluebutton / greenlight

A really simple end-user interface for your BigBlueButton server.
GNU Lesser General Public License v3.0
787 stars 3.8k forks source link

Support for Scalelite Tagged Servers #5790

Closed Ithanil closed 1 week ago

Ithanil commented 3 months ago

This PR adds frontend support for "Tagged Servers" in Scalelite, a feature which is described here: https://github.com/blindsidenetworks/scalelite/pull/1049

Description

This PR allows user to configure two new options for each room: 1) The server tags from a pre-defined list 2) Whether the the server tag is hard required or fallback is allowed when no server is available

In terms of UI, it presents itself as seen in the following screenshots: Screenshot from 2024-04-29 15-48-45 Screenshot from 2024-04-29 15-48-56

The list of available options is defined by the Greenlight administrator and certain tags can be restricted to certain role ids. In the current iteration of this feature, this is done via .env config file and is documented in sample.env:

## Support for Tagged Servers
# If your Greenlight instance is connected to Scalelite or another Loadbalancer with enabled support for the 'meta_server-tag'
# parameter on create calls, you can use the following variables to configure support for this feature via the Greenlight UI.
# When this configuration is changed later, disallowed tags can be removed from the DB via `bundle exec rake server_tags_sync`
# Example configuration (delimiters are , : and /):
# SERVER_TAG_NAMES=tag1:Name 1,tag2:Name2  # defines available tags and their friendly names
# SERVER_TAG_ROLES=tag2:xyz-123-321-aaaa-zyx/abc-321-123-zzzz-cba  # allow tag only for given role ids (see role ids in DB)

The required database migration is included and well tested. No RSpec tests have been added, but the feature is tested in deployment for multiple rooms, configuration combinations etc.

Notes

What is "missing" / Future Development

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

farhatahmad commented 3 weeks ago

There are some architecture changes that I would make here to match the way the rest of the application works:

Once this change is made, I think it would simplify the logic quite a bit

Ithanil commented 3 weeks ago

There are some architecture changes that I would make here to match the way the rest of the application works:

* Don't add the env vars to react unless they are necessary

* What I would do instead is create a `ServerTagsController` and push all of the logic related to fetching the tags into there (including the role stuff)

* then, if server tags is not enabled, just return [ ] instead of a list of available tags (and dont show the dropdown)

* You can then remove it completely from `CurrentUserSerializer`

Once this change is made, I think it would simplify the logic quite a bit

Thanks four your review and I agree with your suggestions. I knew my iteratively developed solution would need a refactoring, but I wanted to have your opinion first to avoid doing it twice. However, I think I won't get it done today as it's basically weekend already here. ;-)

Ithanil commented 3 weeks ago

@farhatahmad That said, do you think the implementation can stay as is in terms of UI/functionality and DB migrations? Because then I would soon be able to deploy the feature for our users independent of the upstream review/merge/release status.

Ithanil commented 3 weeks ago

@farhatahmad I'm done with refactoring. It required me to understand more of the architecture, but as a result I think the code has greatly improved in quality. No env variables are passed to React anymore. Also, now invalid/forbidden tags will silently be dropped by meeting_starter (i.e. falling back to untagged), which matches what a user would see in that case (default label, i.e. untagged). This makes the solution more robust in case an admin forgot to use the sync task after changes and also against malicious users.

farhatahmad commented 2 weeks ago

Definitely a lot cleaner and in line with the way Greenlight is designed. I'll do a full indepth review tomorrow

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud