Skip to content

Commit

Permalink
Allow admins to see private-users info
Browse files Browse the repository at this point in the history
  • Loading branch information
akrolsmir committed Jan 24, 2022
1 parent 9806411 commit e7ef613
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"prod": "mantic-markets",
"dev": "dev-mantic-markets"
}
}
}
6 changes: 5 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"functions": {
"predeploy": "npm --prefix \"$RESOURCE_DIR\" run build",
"runtime": "nodejs12"
"runtime": "nodejs12",
"source": "functions"
},
"firestore": {
"rules": "firestore.rules"
}
}
10 changes: 9 additions & 1 deletion firestore.rules
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
rules_version = '2';

// To deploy: `firebase deploy --only firestore:rules`
service cloud.firestore {
match /databases/{database}/documents {

function isAdmin() {
return request.auth.uid == 'igi2zGXsfxYPgB0DJTXVJVmwCOr2' // Austin
|| request.auth.uid == '5LZ4LgYuySdL1huCWe7bti02ghx2' // James
|| request.auth.uid == 'tlmGNz9kjXc2EteizMORes4qvWl2' // Stephen
|| request.auth.uid == 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' // Manifold
}

match /users/{userId} {
allow read;
}

match /private-users/{userId} {
allow read: if resource.data.creatorId == request.auth.uid;
allow read: if resource.data.creatorId == request.auth.uid || isAdmin();
}

match /contracts/{contractId} {
Expand Down

0 comments on commit e7ef613

Please sign in to comment.