
Код: Выделить всё
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function isAdmin() {
return request.auth != null;
}
function isTeacher() {
return request.auth != null && exists(/databases/$(database)/documents/teachers/$(request.auth.uid));
}
match /students/{uid} {
allow read: if request.auth != null;
allow write: if isAdmin();
}
match /teachers/{uid} {
allow read: if request.auth != null;
allow write: if isAdmin();
}
match /grades/{gradeId} {
allow read: if request.auth != null;
allow create, update: if isTeacher() || isAdmin();
allow delete: if false;
}
match /subjects/{id} {
allow read: if true;
allow write: if false;
}
match /groups/{id} {
allow read: if true;
allow write: if false;
}
match /admins/{id} {
allow read: if request.auth != null;
allow write: if false;
}
match /teacherSubjects/{id} {
allow read: if request.auth != null;
allow write: if false;
}
match /semesterSubjects/{id} {
allow read: if request.auth != null;
allow write: if fa`your text`lse;
}
match /gradesTypes/{id} {
allow read: if true;
allo`your text`w write: if false;
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... ebase-auth