-
Notifications
You must be signed in to change notification settings - Fork 1
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
Restrict dropdown choices #258
Conversation
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.
Not sure if this is related to this PR, but in trying to test this I tried to make a public and a private batch and selected "Module" as the specification for one of them and got the error: "Select a valid choice. That choice is not one of the available choices."
Then when I went to select another choice, "Module" was no longer there ("Module" is an abstract specification, if that helps)
This doesn't address the "Remove AnonymousUser from dropdown options." test in #72 |
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.
This is so hard to test... But I think I found a few places where it needs to be hidden. I made a user that is a contributor and I can see a couple of private things still.
Batches in dropdown (the "None" batch is private - it lost it's name at some point):
Secret Experiments (ie a private experiment that uses a public batch):
Private batches when looking at public experiments (although this one seems like user-error):
Yeah this is a bit annoying. This is unexpected because I've tried explicitly setting For now, at least the form refreshes with a sensible message and reduced list of actually allowed device specs, but I'll flag this in a separate issue. UPDATE |
I had forgotten about the AnonymousUser appearing in the dropdowns issue, but that was an easy fix by modifying the BaseFilter ✅ |
Fixing this for inline forms was a bit fiddly but the solution seems to be working for the create/edit experiment page. Only batches the user has permission to view now appear. |
I don't think this is as much of an issue, but it depends how the experiment is named. The template has now been modified to check the experiment permissions before rendering each row.
Yeh we're getting into the boggy mires of how permissions of various objects should propagate. For simplicity, I've done the same as above and checked the permissions in the template for each batch when each row of the template is rendered. |
Thanks for the thorough checks, @AdrianDAlessandro. Ready for another look 😉 For clarity:
|
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.
Great! Looks like this covers all the issues I commented on
Restricts dropdown choices to those the user has permission for.
This ensures that no private device specifications are listed as options in:
I can't see any other places there could be a risk of this happening.
Closes #72 (finally)