openfun / jitsi-magnify

An authentication and room management system for Jitsi built with Django/React
MIT License
23 stars 6 forks source link

Create a database model to store meetings, groups and users #5

Closed DarkPitoune closed 2 years ago

DarkPitoune commented 2 years ago

Feature Request

Abstract

The auth system should go beyond a simple token provider and store more about the users. Ideally, one could create and plan meetings. A meeting would be defined at a certain time on a certain url. It is planned for a group of guests (registered on the auth or identified by their emails) or can be open to anybody. Each user can also create and manage user groups that will be useful during meetings.

Technical solution

The solution would be a postgresql database created using django's model system. It implements all the features described earlier.

Considered alternatives

A stateless app was thought of but it clearly limits the possibilities of the app.

Adoption strategy

The model is to be laid down on paper as to be implemented later using django's models.

Am I going to work on it through a PR?

Most probably yes, in a very near future

Leonils commented 2 years ago

image

Proposal for the database modeling

Leonils commented 2 years ago

@sampaccoud. Would it be possible to review this database model ?

sampaccoud commented 2 years ago

The graph would be easier to read if you liste the foreign keys and many to many links? Not sure if it's possible.

For Meeting: Use DateTimeField instead of DateField. You don't need the boolean fields for days of the week as you can do start.day... In our https://github.com/openfun/marsha project from which you can reuse a lot of code as it is based on Grommet and the same Ux design as yours... we have chosen to define start and estimated_duration instead of end... and we derive the end by calculating start + estimated_duration. See in this app for example : https://github.com/openfun/marsha/blob/master/src/backend/marsha/bbb/models.py#L108

I didn't understand in groups the sentence : "for anonymous users we create a link". But indeed we need a way to define some emails (phone numbers?) as members of a group for users that don't have an account, right?

For roles on a group or a room, I think we need through models to carry the role? Maybe they can be drawn on the graph.

For Jitsi settings, will it be a json document that we save? Can we retrieve it for an on-going conf from the API? Or should we manually detail in a form all the settings that we want to allow saving?

Leonils commented 2 years ago

Graph Yes, we can work on that

Meetings A meeting has indeed a start (startTime, or better start_time) and a duration (duration, or estimated_duration). But it can be recursive: "any Monday, Thursday, Friday, at 10AM, from the June 6th to the July 8th. So the boolean allow to encode it in an easy way (and easy to retrieve too)

Reuse of marsha If we need to reuse parts of the code of marsha, the best would be to extract it from marsha to a third lib... not an easy task to achieve... That's the kind of consideration that make me a fan of making small reusable libraries.

Groups In the groups, we imagine 2 ways of adding user to a group:

Roles This should be discussed indeed. For now we assumed a room can have a single admin (by default the creator of the room), and many groups that are members. A meeting can also have a single admin (by default the admin of the room) a groups that are invited. Do we need a mode elaborate role system ?

Settings For now, I'm not sure of the structure of the settings. If it's a simple key-value, we can keep it in the pg database. It would be better if we can save it from a meeting indeed.

Leonils commented 2 years ago

Here is an update on the database model, with improved naming and relation displayed.

image

sampaccoud commented 2 years ago

Jitsi settings : in Django the name settings is already used for something else... so maybe call it JitsiConfiguration. Since you already have a group Membership class, I would add a field "role" to it and avoid the "admin" foreignkey to duplicate the membership... For the room admin : ok to start with only one admin in the Ux but it's not much more expensive to materialize the foreignkey via a relation as well in db knowing that you want several admin users soon? The hard part that will delay the feature is the frontend I think.

sampaccoud commented 2 years ago

Note that AbstractUser does not really exist in db. It is only Python code inheritance but there is only 1 User db table.

DarkPitoune commented 2 years ago

Updated version

image