File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "projects": {
3+ "default": "retrotools-284402"
4+ }
5+ }
Original file line number Diff line number Diff line change 5454 run : gcloud auth configure-docker us-east1-docker.pkg.dev && docker push us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT }}/retrograde/retrograde:latest
5555 - name : Deploy new cloudrun revision
5656 run : gcloud run deploy retrotools --image us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT }}/retrograde/retrograde:latest --platform managed --region=us-east1 --project=${{ secrets.GCP_PROJECT }}
57+
58+ deploy-firestore-rules :
59+ runs-on : ubuntu-latest
60+ needs : ci
61+ if : " !contains(github.event.head_commit.message, '[skip ci]') && github.ref == 'refs/heads/master'"
62+ steps :
63+ - uses : actions/checkout@v1
64+ - id : auth
65+ uses : google-github-actions/auth@v1
66+ with :
67+ credentials_json : " ${{ secrets.GCP_ACCOUNT_CREDENTIALS }}"
68+ - name : Install Firebase CLI
69+ run : npm install -g firebase-tools
70+ - name : Deploy Firestore rules
71+ run : firebase deploy --only firestore:rules --project ${{ secrets.GCP_PROJECT }}
Original file line number Diff line number Diff line change 11{
2+ "firestore" : {
3+ "rules" : " firestore.rules"
4+ },
25 "emulators" : {
36 "firestore" : {
47 "port" : 8080
Original file line number Diff line number Diff line change 1+ rules_version = ' 2' ;
2+ service cloud .firestore {
3+ match / databases/ {database }/ documents {
4+ // Default deny
5+ match / {document =** } {
6+ allow read , write : if false ;
7+ }
8+
9+ // Allow read access if user is a board participant
10+ match / boards/ {boardId } {
11+ allow read : if isAuthenticated () && isBoardParticipant (boardId );
12+ }
13+
14+ match / boards/ {boardId }/ {_ =** } {
15+ allow read : if isAuthenticated () && isBoardParticipant (boardId );
16+ }
17+
18+ function isAuthenticated () {
19+ return request .auth != null ;
20+ }
21+
22+ function isBoardParticipant (boardId ) {
23+ return
24+ exists (/ databases/ $(database )/ documents/ participants/ $(request .auth.uid )) &&
25+ / databases/% 28 default% 29 / documents/ boards/ $(boardId ) in get (/ databases/ $(database )/ documents/ participants/ $(request .auth.uid )).data.boards
26+ }
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments