Skip to content

Commit 1fb7efa

Browse files
committed
Cleanups
1 parent 3b4995b commit 1fb7efa

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

firebase-test/src/user-rules.test.ts

-5
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,12 @@ describe("Firestore security rules for user documents", () => {
7272

7373
it("authenticated teachers can read user documents of other teachers in their network", async () => {
7474
await initFirestoreWithOtherUser(teacherAuth, network1);
75-
// not clear why reading the first teacher twice makes a difference,
76-
// but I couldn't get it to work reliably without it ¯\_(ツ)_/¯
77-
await expectReadToSucceed(db, kUserDocPath);
7875
await expectReadToSucceed(db, kUserDocPath);
7976
await expectReadToSucceed(db, kOtherUserDocPath);
8077
});
8178

8279
it("authenticated teachers can't read user documents of teachers in other networks", async () => {
8380
await initFirestoreWithOtherUser(teacherAuth, network2);
84-
// read first teacher twice for consistency with previous case
85-
await expectReadToSucceed(db, kUserDocPath);
8681
await expectReadToSucceed(db, kUserDocPath);
8782
await expectReadToFail(db, kOtherUserDocPath);
8883
});

firestore.rules

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ service cloud.firestore {
259259
allow delete: if false;
260260
// teachers can read offerings in their network
261261
allow read: if (isAuthedTeacher() && resourceInTeacherNetworks()) ||
262-
(isAuthedResearcher() && request.auth.token.class_hash == resource.data.context_id);
262+
resourceInResearcherClass();
263263
}
264264

265265
match /curriculum/{pathId} {

0 commit comments

Comments
 (0)