Skip to content

Commit

Permalink
Switch to the official CEL comment syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
simenheg committed Sep 12, 2023
1 parent 94ec4ad commit e63e700
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ service cloud.firestore {
return isSignedIn() && (isAdminOfOrg || isAdminFromOrgOfProdOrDep);
}

/**
* Return true if the current user is an admin of the organization that
* `document` belongs to.
*
* The document can belong to an organization either by a transitive link
* (`document` → `parent` → `organization`) or directly
* (`document` → `parent`).
*/
//
// Return true if the current user is an admin of the organization that
// `document` belongs to.
//
// The document can belong to an organization either by a transitive link
// (`document` → `parent` → `organization`) or directly
// (`document` → `parent`).
//
function isAdminOfParent(document, type) {
let userDoc = getUserDoc();
let userIsAdmin = isAdmin();
Expand Down Expand Up @@ -78,9 +78,9 @@ service cloud.firestore {
return userIsTeamMember;
}

/**
* Return true if the current user is a member of `document.parent`.
*/
//
// Return true if the current user is a member of `document.parent`.
//
function isMemberOfParent(document, type) {
let userRef = /databases/$(database)/documents/users/$(request.auth.token.email);
let doc = getAfter(/databases/$(database)/documents/$(type)/$(document));
Expand All @@ -89,10 +89,10 @@ service cloud.firestore {
return userIsMemberOfParent;
}

/**
* Return true if the current user is a member of the parent of the
* document's objective *before* performing the action.
*/
//
// Return true if the current user is a member of the parent of the
// document's objective *before* performing the action.
//
function isMemberOfObjectiveParentBefore(document, type) {
let userRef = /databases/$(database)/documents/users/$(request.auth.token.email);
let doc = get(/databases/$(database)/documents/$(type)/$(document));
Expand All @@ -102,10 +102,10 @@ service cloud.firestore {
return userIsMemberOfParent;
}

/**
* Return true if the current user is a member of the parent of the
* document's objective *after* performing the action.
*/
//
// Return true if the current user is a member of the parent of the
// document's objective *after* performing the action.
//
function isMemberOfObjectiveParentAfter(document, type) {
let userRef = /databases/$(database)/documents/users/$(request.auth.token.email);
let doc = getAfter(/databases/$(database)/documents/$(type)/$(document));
Expand Down

0 comments on commit e63e700

Please sign in to comment.