Implementation of a serverless function to allow up- and download of a file.
The files are saved in a Google storage bucket and a Hasura update, insert, or select will be done with a header that allows to check who calls the function and if she(he has sufficient privileges.
Details
The files will be up- and downloaded according to the following structure and the reading and writing access is according to descriptions provided below:
Fallback Images
public/fallback_images/course_cover_image.png
read: public
write: admins only
** Logo images **
public/logos/<logo_name>
read: public
write: admins only
User Profile Images
public/<User.id>/profile_image/<upload_file_name>
read: public
write: user with the corresponding User.id and admins
Cover Images for Courses
public/<Course.id>/cover_image/<upload_file_name>
read: public
write: instructors for the corresponding course und admins
Cover Images for Achievement Records
public/<AchievementRecord.id>/cover_image/<upload_file_name>
read: public
write: user that are authors of the achievement record and admins
Achievement Certificates
<User.id>/<Course.id>/achievement_certificate_<Course.title>.pdf
read: user with the corresponding anonymousId, instructors for the course withe the corresponding Course.Id, and admins
write: only admins
Participation Certificates
/<Course.id>/participation_certificate_<Course.title>.pdf
read: user with the corresponding anonymousId, instructors for the course withe the corresponding Course.Id, and admins
write: only admins
Templates Achievement Certificate
<program_id>/achievement_certificate_template/<uploaded_filename>
read/write: only admins
Templates Participation Certificates
<Program.id>/participation_certificate_template/<uploaded_filename>
read/write: only admins
Optional and Future Implementations