Skip to content

Commit

Permalink
Merge pull request #845 from yeatmanlab/ref/318/query-composables-merge
Browse files Browse the repository at this point in the history
Resolve merge conflicts for TanStack composables
  • Loading branch information
maximilianoertel authored Oct 7, 2024
2 parents a0eb7d5 + 3da09c1 commit 5895961
Show file tree
Hide file tree
Showing 22 changed files with 1,192 additions and 686 deletions.
15 changes: 8 additions & 7 deletions firebase/LEVANTE/admin/firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ service cloud.firestore {
allow read, write: if request.auth.uid == uid;
}

function isUserAdmin() {
let districts = resource.data.get(['districts', 'current'], []);
let schools = resource.data.get(['schools', 'current'], []);
let classes = resource.data.get(['classes', 'current'], []);
let groups = resource.data.get(['groups', 'current'], []);
let families = resource.data.get(['families', 'current'], []);
function isUserAdmin(requireCurrent) {
let orgStatus = requireCurrent ? 'current' : 'all';
let districts = resource.data.get(['districts', orgStatus], []);
let schools = resource.data.get(['schools', orgStatus], []);
let classes = resource.data.get(['classes', orgStatus], []);
let groups = resource.data.get(['groups', orgStatus], []);
let families = resource.data.get(['families', orgStatus], []);
let adminOrgs = get(/databases/$(database)/documents/userClaims/$(request.auth.uid)).data.get('claims', {}).get('adminOrgs', {});
return districts.hasAny(adminOrgs.get('districts', ['..']))
|| schools.hasAny(adminOrgs.get('schools', ['..']))
Expand All @@ -82,7 +83,7 @@ service cloud.firestore {
}

function canReadExistingUser() {
return myData() || isUserAdmin();
return myData() || isUserAdmin(false) || isUserAdmin(true);
}

allow read: if canReadExistingUser();
Expand Down
15 changes: 8 additions & 7 deletions firebase/LEVANTE/assessment/firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ service cloud.firestore {
return uid == roarUid();
}

function isUserAdmin() {
let districts = resource.data.get(['districts', 'current'], []);
let schools = resource.data.get(['schools', 'current'], []);
let classes = resource.data.get(['classes', 'current'], []);
let groups = resource.data.get(['groups', 'current'], []);
let families = resource.data.get(['families', 'current'], []);
function isUserAdmin(requireCurrent) {
let orgStatus = requireCurrent ? 'current' : 'all';
let districts = resource.data.get(['districts', orgStatus], []);
let schools = resource.data.get(['schools', orgStatus], []);
let classes = resource.data.get(['classes', orgStatus], []);
let groups = resource.data.get(['groups', orgStatus], []);
let families = resource.data.get(['families', orgStatus], []);
let adminOrgs = get(/databases/$(database)/documents/userClaims/$(request.auth.uid)).data.get('claims', {}).get('adminOrgs', {});
return districts.hasAny(adminOrgs.get('districts', ['..']))
|| schools.hasAny(adminOrgs.get('schools', ['..']))
Expand All @@ -70,7 +71,7 @@ service cloud.firestore {
}

function canReadExistingUser() {
return myData() || isUserAdmin();
return myData() || isUserAdmin(false) || isUserAdmin(true);
}

allow read: if canReadExistingUser();
Expand Down
Loading

0 comments on commit 5895961

Please sign in to comment.