Skip to content

04 Backend Handbook

SimoLoca edited this page May 10, 2022 · 8 revisions

Intro

Backend is a Flask web-application that let user manage collected data, it gives the possibility to different users to perform different actions based on the permissions assigned to them. Thus, we can manage 3 kind of users (even if nothing prevents you from increasing this number,you will only have to appropriately modify the structure of the database and the web-app):

  • Administrators: full privileged user, can upload data, models, ecc.
  • Guest: can only visualize collected data and download them
  • Not verified: user registered to the platform but not yet verified, thus, cannot login

Sign Up & Login

login_signup

Next, we can connect to our new server (exposed locally on port 54320, as defined in Pignoletto_platform_Docker/src/docker-compose.yml), for example with the pgAdmin tool (or any other tool):

login_signup

User verification

After a user requested for signing up, it must be verified to allow him navigate through the app, thus you had to modify its property saved in PostgreSQL in user table:

UPDATE public."user"
	SET verified=true
	WHERE <condition>;

Once a user has been verified it can login into the web-app as guest user.

login_signup

Create a user administrator

In order to make a user administrator you just need to change its property saved in PostgreSQL in user_role table, in particular role_id equal to 1 (1 for admin, 2 for guest):

UPDATE public.user_role
	SET role_id=1
	WHERE user_id=<USER_ID>;

login_signup

Now, as administrator, in addition to being able to view the collected data and download them as CSV, you can enter new ones, upload models to be exploited in Platform and upload images.


Previous Section: Project structure

Next Section: Platform Handbook

Clone this wiki locally