How can I create permission for read files in cloud storage and set the permission in firestore.
- The owner can read/update
- The owner can select how can read the file
- Only he
- His friends (friends node)
- Selected users (he select the users id.)
If a user for some reason have the URL but this is not the owner and not is in the readers list I want this not have permission in cloud storage.
List item
Firestore model is something like this:
users: {
-user1 {
- friends {
user3 {
"name":...
"photoUrl":...
},
user2 {
"name":...
"photoUrl":...
}
}
...
}
-user2
-user3
}
}
posts: {
-post1 {
"owner": user1,
"description":...
"fileUrl": fileUrlOnFirebaseCloudStorage,
"timestamp"...
"privacy": // private, public, friends, customs users
// how to set this ?
}
-post2
-post3
}
}
And what is the rules for firestore and firebase cloud storage?