You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Different users should have different permissions regarding viewing, editing and deleting files, based on each user's assigned roles.
We proposed the following roles:
Viewer
These users can view files that have been uploaded by others, but they cannot upload files themselves. They cannot edit metadata on existing files, or delete existing files.
Editor
These users can view files, but they can also upload new files and edit metadata on existing ones.
Admin
These users can do everything that the other two user groups can do. Additionally, they can manage the permissions of other users: they can set other users to be one of these three roles.
We can tweak these permissions later on if we want (for example, we could allow viewers to upload files). But the main thing is to set up a system whereby each user is assigned one of these three roles, and each role has different access rights on files.
How
We don't have access to edit data on the Firebase Auth object itself. That means, we need to save our own data on each user in Firestore, storing a User class object for each user. In that object in the database, we'll save a "roles" object, which can have either a Viewer, Editor or Admin attribute. We will link the entry in the Firestore database to a user in Firebase Auth by using the UUID for each user.
An example of how the User object in the database could look:
His Roles are different to ours, and have slightly different permissions to what we want. But the structure can still be the same
He uses AngularFireDatabase (passed in as db), whereas we want to use AngularFirestore. They should be very similar to work with
See src/app/services/shared/service/data/data.service.ts for how we currently use AngularFirestore (passed in as afs)
He sets the user permissions on "Posts", which live in his database. We want to set the permissions on our metadata, which exists in Firestore and is accessed via the src/app/services/shared/service/data/data.service.ts file. And we also want to set permissions on our files, which live in Firebase Storage and are accessed via the src/app/services/shared/service/file/file.service.ts file.
I would recommend watching the video a couple of times before you start coding, in order to get an idea of what he's doing (he goes very fast).
The text was updated successfully, but these errors were encountered:
What
Different users should have different permissions regarding viewing, editing and deleting files, based on each user's assigned roles.
We proposed the following roles:
We can tweak these permissions later on if we want (for example, we could allow viewers to upload files). But the main thing is to set up a system whereby each user is assigned one of these three roles, and each role has different access rights on files.
How
We don't have access to edit data on the Firebase Auth object itself. That means, we need to save our own data on each user in Firestore, storing a User class object for each user. In that object in the database, we'll save a "roles" object, which can have either a Viewer, Editor or Admin attribute. We will link the entry in the Firestore database to a user in Firebase Auth by using the UUID for each user.
An example of how the User object in the database could look:
Here is a very good tutorial that should be helpful: https://www.youtube.com/watch?v=3qODuvp1Zp8&ab_channel=Fireship
Important: We can't use his example exactly, as we have the following differences:
db
), whereas we want to use AngularFirestore. They should be very similar to work withsrc/app/services/shared/service/data/data.service.ts
for how we currently use AngularFirestore (passed in asafs
)src/app/services/shared/service/data/data.service.ts
file. And we also want to set permissions on our files, which live in Firebase Storage and are accessed via thesrc/app/services/shared/service/file/file.service.ts
file.I would recommend watching the video a couple of times before you start coding, in order to get an idea of what he's doing (he goes very fast).
The text was updated successfully, but these errors were encountered: