Problem/Motivation
Please refer the problem/motivation section of #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method
Proposed resolution
Write EntityResourceTestBase subclass for the FilterFormat entity.
Remaining tasks
References
1. Follow-up of #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method
2. Subtask of #2824572: Write EntityResourceTestBase subclasses for every other entity type.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | interdiff.txt | 1.16 KB | Anonymous (not verified) |
| #11 | rest_filter_format-2843757-11.patch | 8.78 KB | Anonymous (not verified) |
Comments
Comment #3
Anonymous (not verified) commentedCan we add
'view'to the'use'condition?Comment #4
wim leersI'm not sure this is desirable. using is very different from viewing. Viewing means you are allowed to see the filters in this text format… which may be sensitive. So I think that for
$operation === 'view'you actually only want to grant access if the user has theadminister filterspermission.Other than that, this is looking great!
Comment #5
mavillalba commentedComment #6
mavillalba commentedI'll work in this. I sent to test with the version 8.4.x.
Comment #7
mavillalba commentedComment #8
Anonymous (not verified) commentedThanks for the wise advice @Wim Leers! I chose
'use', because not want free permissions to'view'. But'administer filters'eliminates this problem of course :)@mavillalba, thank you for your interest in this issue. Few fails with 8.4.x looks like #2859704: Intermittent segfaults on DrupalCI (some "did not complete due to a fatal error" with no additional info). We should not worry much about random faults here.
Comment #9
wim leersLooks perfect to me :)
Comment #10
alexpottIs there a generic issue discussing config entity view access? And it is worth considering adding generic behaviour to check the admin permission defined in a config entity' entity type plugin annotation?
Looking more deeply at the code... I think there might be a better fix. We can change:
to
Since in the parent class it does:
Less hard coding of permission names and more default behaviour...
Comment #11
Anonymous (not verified) commented@alexpott, thank you for the help! Your advice looks absolutely compatible with the advice of @Wim Leers about
'administer filters'and definitely has sense. Let's do it.Comment #12
wim leers+1!
Good catch, @alexpott :)
Comment #13
alexpottCommitted and pushed 4826159 to 8.4.x and 8dfab09 to 8.3.x. Thanks!
I've committed this to 8.3.x because whilst there is a run-time change to FilterFormatAccessControlHandler is makes sense and could be considered a bugfix and has ample test coverage added.