Skip to content

Commit

Permalink
fix: review security rules
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Jan 27, 2024
1 parent 5cac276 commit 208e704
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions firestore.cloudnord.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /companies-2023/{companyId} {
allow list, update: if isGdgLille() || notUpdating('name');
allow list, update: if isAdministrator() || notUpdating('name');
allow create, get: if true;
}
match /companies-2024/{companyId} {
allow list, update: if isGdgLille() || notUpdating('name');
allow list, update: if isAdministrator() || notUpdating('name');
allow create, get: if true;
}
match /workflows/{workflowId} {
Expand All @@ -15,7 +15,7 @@ service cloud.firestore {
}
match /configuration/{configurationId} {
allow get: if true;
allow update: if isGdgLille();
allow update: if isAdministrator();
}
}
}
Expand All @@ -27,6 +27,6 @@ function notUpdating(field) {
function isOwner(companyId) {
return request.auth.token.email in resource.data.email;
}
function isGdgLille() {
return request.auth.token.email.matches(".*@gdglille.org")
function isAdministrator() {
return request.auth.token.email.matches(".*@cloudnord.fr")
}
8 changes: 4 additions & 4 deletions firestore.devfest.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /companies-2023/{companyId} {
allow list, update: if isGdgLille() || notUpdating('name');
allow list, update: if isAdministrator() || notUpdating('name');
allow create, get: if true;
}
match /companies-2024/{companyId} {
allow list, update: if isGdgLille() || notUpdating('name');
allow list, update: if isAdministrator() || notUpdating('name');
allow create, get: if true;
}
match /workflows/{workflowId} {
Expand All @@ -15,7 +15,7 @@ service cloud.firestore {
}
match /configuration/{configurationId} {
allow get: if true;
allow update: if isGdgLille();
allow update: if isAdministrator();
}
}
}
Expand All @@ -27,6 +27,6 @@ function notUpdating(field) {
function isOwner(companyId) {
return request.auth.token.email in resource.data.email;
}
function isGdgLille() {
function isAdministrator() {
return request.auth.token.email.matches(".*@gdglille.org")
}
12 changes: 6 additions & 6 deletions storage.cloudnord.rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ service firebase.storage {
match /facture {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}
match /flyers {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}
match /devis {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}
match /conventionSigned {
Expand All @@ -43,12 +43,12 @@ service firebase.storage {
match /convention {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}

}
}
function isGdgLille() {
return request.auth.token.email.matches(".*@gdglille.org")
function isAdministrator() {
return request.auth.token.email.matches(".*@cloudnord.fr")
}
10 changes: 5 additions & 5 deletions storage.devfest.rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ service firebase.storage {
match /facture {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}
match /flyers {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}
match /devis {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}
match /conventionSigned {
Expand All @@ -43,12 +43,12 @@ service firebase.storage {
match /convention {
match /{allPaths=**} {
allow read: if true;
allow write: if isGdgLille();
allow write: if isAdministrator();
}
}

}
}
function isGdgLille() {
function isAdministrator() {
return request.auth.token.email.matches(".*@gdglille.org")
}

0 comments on commit 208e704

Please sign in to comment.