%syntax-version=1.0.0 %project=tipus %uri=https://dev.tandem.ws/tandem/tipus roles 2023-06-04T19:01:41Z jordi fita mas # Add database roles schema_auth [roles] 2023-06-04T19:08:37Z jordi fita mas # Add authentication schema schema_public [roles] 2023-06-04T19:11:16Z jordi fita mas # Set privileges to public schema schema_tipus [roles] 2023-06-04T19:13:28Z jordi fita mas # Add application schema extension_citext [schema_public] 2023-06-04T19:15:31Z jordi fita mas # Add citext extension email [schema_tipus extension_citext] 2023-06-04T19:18:12Z jordi fita mas # Add citext extension language [roles schema_public] 2023-06-04T19:20:29Z jordi fita mas # Add relation of available languages available_languages [schema_public language] 2023-06-04T19:23:35Z jordi fita mas # Add the initial available languages user [schema_auth email language] 2023-06-04T19:26:15Z jordi fita mas # Add user relation ensure_role_exists [schema_auth user] 2023-06-04T19:28:20Z jordi fita mas # Add trigger to ensure the user’s role exists extension_pgcrypto [schema_auth] 2023-06-04T19:30:11Z jordi fita mas # Add pgcrypto extension encrypt_password [schema_auth user extension_pgcrypto] 2023-06-04T19:32:12Z jordi fita mas # Add trigger to encrypt user’s password login_attempt [schema_auth] 2023-06-04T19:35:24Z jordi fita mas # Add relation to log login attempts check_cookie [roles schema_public schema_auth user] 2023-06-04T19:47:48Z jordi fita mas # Add function to check if a user cookie is valid current_user_cookie [roles schema_tipus] 2023-06-04T19:40:43Z jordi fita mas # Add function to get the cookie of the current Tipus’ user current_user_email [roles schema_tipus] 2023-06-04T19:42:44Z jordi fita mas # Add function to get the email of the current Tipus’ user build_cookie [roles schema_tipus current_user_email current_user_cookie] 2023-06-04T19:44:45Z jordi fita mas # Add function to build the cookie for the current user set_cookie [roles schema_public check_cookie] 2023-06-04T19:50:49Z jordi fita mas # Add function to set the role based on the cookie login [roles schema_auth schema_tipus extension_pgcrypto email user login_attempt build_cookie] 2023-06-04T19:53:03Z jordi fita mas # Add function to login logout [roles schema_auth schema_tipus current_user_email current_user_cookie user] 2023-06-04T19:56:18Z jordi fita mas # Add function to logout user_profile [roles schema_tipus user current_user_email current_user_cookie] 2023-06-04T19:58:34Z jordi fita mas # Add view for user profile change_password [roles schema_auth schema_tipus user] 2023-06-04T20:00:49Z jordi fita mas # Add function to change the current user’s password