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

Fix form level permission restrictions on search #1691

Merged

Conversation

lincmba
Copy link
Contributor

@lincmba lincmba commented Oct 1, 2019

Form level permission restrictions were failing upon searching the data.
This PR addresses this issue.

fixes #1692

Signed-off-by: lincmba [email protected]

@lincmba lincmba requested a review from ukanga October 1, 2019 04:30
Copy link
Member

@ukanga ukanga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me how this changes and tests address the permissions issue. I think adding only the code below on line 318 in the test will result in the exact same result without any code changes.

 self.assertListEqual(
            [r['_submitted_by'] for r in response.data], ['alice', 'alice'])

@ukanga
Copy link
Member

ukanga commented Oct 1, 2019

@lincmba Is it that the query parameter is a list instead of a string? And we only handle the case when it is a string and not a list? From the test, it is not clear that is what you check.

@lincmba
Copy link
Contributor Author

lincmba commented Oct 1, 2019

@ukanga

Is it that the query parameter is a list instead of a string? And we only handle the case when it is a string and not a list? From the test, it is not clear that is what you check.

Yes this is exactly what was happening. We only handled the case when its either a dictionary ie query = {"_submitted_by": "bob"} or when its a string i.e query="ambulance" but not when its a list of both query=[{"_submitted_by": "bob"}, "ambulance"].

I have included more tests for clarity.

@ukanga ukanga merged commit 0a9acc2 into master Oct 1, 2019
@ukanga ukanga deleted the fix_failing_permissions_restrictions_on_searching_data branch October 1, 2019 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form Permissions are not applied when searching submissions
2 participants