-
Notifications
You must be signed in to change notification settings - Fork 18
Groups join=projects Parameter #883
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
Conversation
02bc5e6
to
3babfb7
Compare
api/dao/base.py
Outdated
except KeyError: | ||
raise APINotFoundException('Children cannot be listed from the {0} level'.format(self.cont_name)) | ||
query = {self.cont_name[:-1]: bson.ObjectId(_id)} | ||
if self.cont_name == 'groups': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use self.use_object_id
here instead of keying directly on groups, right now there isn't a difference because the other container that don't use an object id don't ever call get_children but we'd like to respect what the storage instance chooses.
api/dao/base.py
Outdated
raise APINotFoundException('Children cannot be listed from the {0} level'.format(self.cont_name)) | ||
query = {self.cont_name[:-1]: bson.ObjectId(_id)} | ||
if self.cont_name == 'groups': | ||
query = {self.cont_name[:-1]: _id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a utility method in contianerutil.py
that singularizes container names, mind changing this existing code to use that instead? Analysis -> Analyses ruined the "remove the s" hack (also wouldn't affect us here since analyses don't have children but good to clean up that old hack when we can).
Looks good 👍 Just a bit of cleanup. Also FYI @dpuccetti |
api/dao/base.py
Outdated
if uid: | ||
query['permissions'] = {'$elemMatch': {'_id': uid}} | ||
else: | ||
query = {self.cont_name[:-1]: bson.ObjectId(_id)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more right here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And wouldn't you want to respect the uid match no matter the container? I must have missed that in the first review.
ae7d573
to
9314884
Compare
Changes look good, thanks! |
9314884
to
2b32ef0
Compare
Fixes #853
For
api/groups?join=projects
, each group result is returned with a a list of that group's project that the user has access to, permissions are filtered for the projects as well.Specifically returned for each project are its
Review Checklist