Please sign in to comment.
EZP-29474: Fix wrong usage of hasAccess in repository (#2413)
* EZP-29474: Fix wrong usage of hasAccess in repository Fix wrong usage\* of `hasAccess()` in repository in favor of `canUser()` in order to solve: - Issues when there are Role Assignment Limitation - As policies are now extendable, better be prepared in case someone needs to customize and add limitations to any of these functions I effect this makes Repo more correctly use permissions system, and will avoid quite some unneeded exceptions all across the repo. There is also two behavour changes _(in terms of api spec)_ which will simplify API usage: - loadSections(): PR proposes to change this to just filter sections _(preparing it for we/others adding policy limitations on the function, & avoiding issue with role limitation)_ - load user drafts: Same, proposes to filter the returned drafts instead of throwing \* _Long story short, we forgot about Role limitations + extensibility when coding this, and made shortcuts hard coding that assumption, this PR fixes that._ * [API Doc] Add some api doc to clearify usage. Also fix CS issue on test. Other fixes: * Always use target location on trash restore to properly take subtree limitations into account * Adapt SubtreeLimitation to abstain on trashed content when no location target is provided (abstain is for for role limitations, means they will be ignored)
- Loading branch information...
Showing with 132 additions and 83 deletions.
- +6 −3 eZ/Publish/API/Repository/PermissionResolver.php
- +7 −2 eZ/Publish/Core/Limitation/SubtreeLimitationType.php
- +10 −10 eZ/Publish/Core/Limitation/Tests/SubtreeLimitationTypeTest.php
- +1 −0 eZ/Publish/Core/Repository/ContentService.php
- +14 −14 eZ/Publish/Core/Repository/ContentTypeService.php
- +5 −5 eZ/Publish/Core/Repository/LanguageService.php
- +7 −7 eZ/Publish/Core/Repository/ObjectStateService.php
- +29 −20 eZ/Publish/Core/Repository/SectionService.php
- +16 −4 eZ/Publish/Core/Repository/Tests/Service/Integration/TrashBase.php
- +21 −10 eZ/Publish/Core/Repository/Tests/Service/Mock/UrlWildcardTest.php
- +15 −7 eZ/Publish/Core/Repository/TrashService.php
- +1 −1 eZ/Publish/Core/Repository/URLWildcardService.php
Oops, something went wrong.