Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase Argue Rule #343

Open
jtjun opened this issue Apr 11, 2021 · 1 comment
Open

Firebase Argue Rule #343

jtjun opened this issue Apr 11, 2021 · 1 comment
Assignees
Labels
refactor Refactor codes but not affect their functions
Milestone

Comments

@jtjun
Copy link
Member

jtjun commented Apr 11, 2021

No description provided.

@jtjun jtjun added the refactor Refactor codes but not affect their functions label Apr 11, 2021
@jtjun jtjun added this to the Node System milestone Apr 11, 2021
@VertexToEdge
Copy link
Contributor

function validateUpdateArgue(){
	let old = resource.data;
	let new = request.resource.data;
	let modified = old.diff(new).affectedKeys();
	return modified.hasOnly(['isClosed', 'modifiedAt']) || modified.hasOnly(['isClosed', 'modifiedAt']);
}

match /argue/{id} {
         allow read: if true;
         allow create: if validateArgue(request.resource) && validateOwner(request.resource);
         allow update: if validateUpdateStatistics() || validateUpdateArgue() ||
         				(validateArgue(request.resource)
       					  && resource.data.ownerId == request.auth.uid);
             allow delete: if 
      resource.data.ownerId == request.auth.uid;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactor codes but not affect their functions
Projects
None yet
Development

No branches or pull requests

2 participants