Skip to content

Added requirement to use ignoreAcls() when retrieving data from datastore #541

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

Merged
merged 1 commit into from
Jul 26, 2018
Merged

Added requirement to use ignoreAcls() when retrieving data from datastore #541

merged 1 commit into from
Jul 26, 2018

Conversation

jamesncl
Copy link
Contributor

Can affect ParseObjects configured with Role based ACLs. Related to issue #428 in Android SDK. This note is present in iOS documentation only, but also affects Android. Note that applying query.ignoreAcls() then makes the query unusable for network queries (generates exception "ignoreAcls cannot be mixed with network queries").

…tore which is configured with Role based ACLs
Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

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

Perfect! Thanks for the PR!

@flovilmart flovilmart merged commit 841f5f3 into parse-community:gh-pages Jul 26, 2018
@jamesncl
Copy link
Contributor Author

I've discovered that calling ignoreAcls() on a query then makes that query unusable for network calls, raising this exception:

java.lang.IllegalStateException: ignoreACLs cannot be combined with network queries

This is problematic if you want to use a query to load from datastore, then later use the same query to load from network. I can't see any method to "undo ignoreAcls", so you would have to reconstruct the query (ugh). I think a note about this should be added, the problem is I don't exactly know when you really NEED to call ignoreAcls for a data store query so unsure what the advice should be. It seemed to work fine for some of my classes, and not others, and I can't figure out what difference in Roles is responsible (they are all the same as far as I can determine). So now I'm not sure what to do... do we need to revert this change? Or perhaps the documentation amendment needs to be something along the lines of "if you experience problems loading results from the local data store for classes utilising role based ACLs you MAY need to call applyAcls..."?

@flovilmart
Copy link
Contributor

You should probably use a factory method that generate you that query, and then run that query on the localDatastore and network independentlyx

@jamesncl
Copy link
Contributor Author

jamesncl commented Jul 26, 2018

Yeah, this is what I've just implemented in my project. It's quite ugly though, so now think that ignoreAcls should only be used if you need to. Should I create a new pull request to make this clearer? PS also found this on SO, confirms the same issue and suggests an alternative solution (setting ACLs when pinning):
https://stackoverflow.com/questions/24659129/role-acl-doesnt-work-using-parses-android-local-datastore/31950750#31950750

@flovilmart
Copy link
Contributor

Yep go ahead! Anything that can make it clearer is always welcome!

@jamesncl
Copy link
Contributor Author

Made another pull request, it said it couldn't automatically merge... is that okay? I've got a bit of Git learning to do...

@flovilmart
Copy link
Contributor

@jamesncl it's all good. The PR said it couldn't merge because the branch used for the PR was out of sync with the target branch. I just had to fix the conflicts and it's all good!

Thanks for the PR's! It's well appreciated!

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.

3 participants