Rule update
This commit is contained in:
parent
5650dada42
commit
4cb3a29aef
1 changed files with 5 additions and 5 deletions
|
@ -4,17 +4,16 @@ service cloud.firestore {
|
||||||
function sameUser(user) {
|
function sameUser(user) {
|
||||||
return request.auth != null && request.auth.uid == user;
|
return request.auth != null && request.auth.uid == user;
|
||||||
}
|
}
|
||||||
/*function getUserData() {
|
function getUserData() {
|
||||||
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data;
|
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
//Felhasználói adatok kezelése
|
//Felhasználói adatok kezelése
|
||||||
match /users/{user} {
|
match /users/{user} {
|
||||||
allow create: if sameUser(user) && request.auth.uid == request.resource.data.author_uid;
|
allow read, write: if sameUser(user) && request.auth.uid == request.resource.data.author_uid;
|
||||||
allow get, list, update, delete: if sameUser(user) && request.auth.uid == resource.data.author_uid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Adminoknak mindent lehet
|
//Adminisztrátoroknak mindent lehet
|
||||||
match /data/{document=**} {
|
match /data/{document=**} {
|
||||||
allow get, list, create, update, delete: if auth.token.admin;
|
allow get, list, create, update, delete: if auth.token.admin;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +21,7 @@ service cloud.firestore {
|
||||||
match /data/subjects/{subject=**} {
|
match /data/subjects/{subject=**} {
|
||||||
allow get, list: if request.auth.uid in resource.data.students;
|
allow get, list: if request.auth.uid in resource.data.students;
|
||||||
}
|
}
|
||||||
|
//Az oktatók módosithatják a követelményeket
|
||||||
match /data/subjects/{subject}/requirements/{requirement=**} {
|
match /data/subjects/{subject}/requirements/{requirement=**} {
|
||||||
allow read, write: if request.auth.uid in resource.data.teachers;
|
allow read, write: if request.auth.uid in resource.data.teachers;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue