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

Orphaned Groups #31

Open
linux4life798 opened this issue Nov 21, 2017 · 2 comments
Open

Orphaned Groups #31

linux4life798 opened this issue Nov 21, 2017 · 2 comments

Comments

@linux4life798
Copy link
Member

It looks like groups linger around after the last member leaves.
This should be looked into.

@khush-bhatia
Copy link
Collaborator

Just FYI, I intentionally included group memberships in user model . Since mongodb is a document store, data that is often read together should be saved in same document. Since groups are used for access control and read performance is very important for access control, I made this design choice.

Because of this design, deleting orphaned groups becomes non trivial. If you decide to change the model to make delete groups easier, please keep ACL read performance in consideration in the new design.

Following are two suggestions to fix this bug with the current design:

  1. Everytime a member is deleted from group, do a search to see if there are no more members left in group.
  2. Run an independent piece of code that periodically scans and deletes empty groups.

@linux4life798
Copy link
Member Author

linux4life798 commented Mar 23, 2018

Yep, that makes sense.
The first option seems like the most direct.

Do you need to worry about race conditions in Node.js+express+mongoose+magic-elves? Like TOCTU for checking group membership and deleteing it? Does mongo+mongoose prevent deletion of documents that are referenced?
Does Node.js + express have the notion of locks?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants