Node grants gets its operation from the query's "op" metadata. Entity API's query access alters hardcode the operation to view. Let's fix this by mimicking the node grants system's way of retrieving an operation.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screenshot 2020-07-09 at 4.44.48 PM.png | 12.97 KB | sanjayk |
| #10 | 3134160-10.patch | 18.96 KB | sanjayk |
| #9 | support_all_operatio-3134160-8.patch | 691 bytes | kristiaanvandeneynde |
| #8 | interdiff-3134160-2-8.txt | 783 bytes | kristiaanvandeneynde |
Comments
Comment #2
kristiaanvandeneyndeSeems like the views query does not support getMetadata (but rather $options) so there's no operation to retrieve there.
Comment #3
moshe weitzman commentedPretty sure the = instead of == is deliberate here. LGTM.
Comment #4
kristiaanvandeneyndeIt sure is :D
Comment #5
berdirNitpick, but can't we just write this as $query_access->getConditions($query->getMetaData('op') ?: 'view');
Avoids the quite tricky conditional inverted if condition and we don't need operation afterwards.
Comment #6
kristiaanvandeneyndeSure, that would work :)
Comment #7
sanjayk commentedWorking on coding standard issues.
Comment #8
kristiaanvandeneyndeNot sure what coding standards issues can be worked on in a 1-line patch (as per #5)
Comment #9
kristiaanvandeneyndeUgh, first time using the awesome drupalorg-cli for generating patches and got the wrong one :)
Comment #10
sanjayk commentedFixed coding standard issues. Few are still left which is based on ie:Doc comment etc.
Comment #11
sanjayk commentedAnd also patch apply successfully.
Comment #13
berdirCommitted. And if we ever need it as a variable, we could still do the same assigned to the variable instead.
Comment #14
tormi@sanjayk, the issue etiquette applies here, could you please follow it?
Comment #15
sanjayk commented@tormi sure I will follow thanks.