-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
EZP-29539: Deleting object will remove all subtree items even when user does not have permission to delete them #2536
Conversation
$this->settings = $settings + array( | ||
//'defaultSetting' => array(), | ||
); | ||
$this->settings = $settings + array(//'defaultSetting' => array(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->settings = $settings + array(//'defaultSetting' => array(), | |
$this->settings = $settings; |
@@ -294,7 +301,8 @@ public function findTrashItems(Query $query) | |||
|
|||
foreach ($query->sortClauses as $sortClause) { | |||
if (!$sortClause instanceof SortClause) { | |||
throw new InvalidArgumentValue('query->sortClauses', 'only instances of SortClause class are allowed'); | |||
throw new InvalidArgumentValue('query->sortClauses', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, fix CS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, such changes shouldn't be in PR until they are necessary to fix a bug 😉
|
||
$contentRemoveCriterion = $this->permissionCriterionResolver->getPermissionsCriterion('content', 'remove'); | ||
|
||
if ($contentRemoveCriterion === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
if ($contentRemoveCriterion === false) { | |
if (is_bool($contentRemoveCriterion)) { | |
return $contentRemoveCriterion; | |
} | |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit/integration tests are missing also CI failure is related.
@@ -63,15 +69,16 @@ public function __construct( | |||
RepositoryInterface $repository, | |||
Handler $handler, | |||
Helper\NameSchemaService $nameSchemaService, | |||
array $settings = array() | |||
array $settings = array(), | |||
PermissionCriterionResolver $permissionCriterionResolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no BC promise for constructors so please move $permissionCriterionResolver
before $settings
@@ -12,6 +12,8 @@ | |||
use eZ\Publish\API\Repository\Repository as RepositoryInterface; | |||
use eZ\Publish\API\Repository\Values\Content\Content; | |||
use eZ\Publish\API\Repository\Exceptions\UnauthorizedException as APIUnauthorizedException; | |||
use eZ\Publish\Core\REST\Client\Values\Content\ContentInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use eZ\Publish\Core\REST\Client\Values\Content\ContentInfo; |
return false; | ||
} | ||
|
||
$contentRemoveCriterion = $this->permissionCriterionResolver->getPermissionsCriterion('content', 'remove'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any scenario that this can return true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to docs, yes
ezpublish-kernel/eZ/Publish/API/Repository/PermissionCriterionResolver.php
Lines 16 to 26 in ae9dff7
/** | |
* Get criteria representation for a permission. | |
* | |
* Will return a criteria if current user has limited access to the given module/function, | |
* however if user has either full or no access then boolean is returned. | |
* | |
* @param string $module | |
* @param string $function | |
* | |
* @return bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And that was my point ;)
d17ca05
to
eee0379
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, but as this is bug it might be something that should be backported further back?
@@ -23,6 +24,10 @@ | |||
use eZ\Publish\API\Repository\Values\Content\Trash\SearchResult; | |||
use eZ\Publish\API\Repository\Values\Content\Query\Criterion; | |||
use eZ\Publish\API\Repository\Values\Content\Query\SortClause; | |||
use eZ\Publish\API\Repository\PermissionCriterionResolver; | |||
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\LogicalAnd as CriterionLogicalAnd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\LogicalAnd as CriterionLogicalAnd; | |
use eZ\Publish\API\Repository\Values\Content\Query\Criterion; |
in many places in the kernel it is used like this
@barbaragr @pawbuj what is the status here? |
@lserwatka as Andre said: |
@andrerom but does it really make sense to back-port it to 1.7? 1.x is in SPA architecture, with zero permissions check, this might require work on frontend side to handle those exceptions properly. I don't see any benefit here especially that report was related to 2.x only. |
@lserwatka The way I read this it's a kernel bug affecting all use of the application, api's and UI, it can also be argued to be security issue. Did QA uncover any major 1.x UI issues happening with this? I would assume that is more in regards to how we handle this in REST API which is maybe anyway a todo here on this PR(?) |
This comment has been minimized.
This comment has been minimized.
f3f2a69
to
63f3721
Compare
…er does not have permission to delete them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retest OK on eZ Platform EE v1.7.8.
On v1.13.4 retesting before merge is blocked by http-cache dependencies.
Adding v2 test status in second PR.
Could you merge it up? |
Retest OK on eZ Platform EE v1.13.4. |
merged |
7.2
Checking permission to remove content for all elements in the subtree.
TODO:
$ composer fix-cs
).