-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-10854 not possible to hide content draft #667
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
base: 4.6
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <?php | ||
|
|
||
| /** | ||
|
|
@@ -2528,14 +2528,17 @@ | |
| */ | ||
| public function hideContent(ContentInfo $contentInfo): void | ||
| { | ||
| $locationTarget = (new DestinationLocationTarget($contentInfo->mainLocationId, $contentInfo)); | ||
| if (!$this->permissionResolver->canUser( | ||
| 'content', | ||
| 'hide', | ||
| $contentInfo, | ||
| [$locationTarget] | ||
| )) { | ||
| throw new UnauthorizedException('content', 'hide', ['contentId' => $contentInfo->id]); | ||
| // If content is in draft state, mainLocationId is yet not set | ||
| if ($contentInfo->mainLocationId !== null) { | ||
|
||
| $locationTarget = (new DestinationLocationTarget($contentInfo->mainLocationId, $contentInfo)); | ||
| if (!$this->permissionResolver->canUser( | ||
| 'content', | ||
| 'hide', | ||
| $contentInfo, | ||
| [$locationTarget] | ||
| )) { | ||
| throw new UnauthorizedException('content', 'hide', ['contentId' => $contentInfo->id]); | ||
| } | ||
| } | ||
|
|
||
| $this->repository->beginTransaction(); | ||
|
|
@@ -2568,14 +2571,17 @@ | |
| */ | ||
| public function revealContent(ContentInfo $contentInfo): void | ||
| { | ||
| $locationTarget = (new DestinationLocationTarget($contentInfo->mainLocationId, $contentInfo)); | ||
| if (!$this->permissionResolver->canUser( | ||
| 'content', | ||
| 'hide', | ||
| $contentInfo, | ||
| [$locationTarget] | ||
| )) { | ||
| throw new UnauthorizedException('content', 'hide', ['contentId' => $contentInfo->id]); | ||
| // If content is in draft state, mainLocationId is yet not set | ||
| if ($contentInfo->mainLocationId !== null) { | ||
| $locationTarget = (new DestinationLocationTarget($contentInfo->mainLocationId, $contentInfo)); | ||
| if (!$this->permissionResolver->canUser( | ||
| 'content', | ||
| 'hide', | ||
| $contentInfo, | ||
| [$locationTarget] | ||
| )) { | ||
| throw new UnauthorizedException('content', 'hide', ['contentId' => $contentInfo->id]); | ||
| } | ||
| } | ||
|
|
||
| $this->repository->beginTransaction(); | ||
|
|
||
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.
Doesn't this mean, with this change, that for drafts every user has ability to hide & reveal?
Because we won't be checking permission resolver for drafts.