Skip to content

IBX-9838: FIX Edit option in three-dot menu remains clickable despite insufficient user permissions #1525

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

Open
wants to merge 2 commits into
base: 4.6
Choose a base branch
from

Conversation

Sztig
Copy link
Contributor

@Sztig Sztig commented Apr 15, 2025

🎫 Issue IBX-9838

Description:

As stated in the public ticket, when the user has a limitation, for example, only for a specific content type, lets say Article, if we go to the Content tree, click on any other content type and open the context menu, the edit button would be clickable and it would throw a permission error.
I'm fixing here the edit check to rely on this->permissionResolver->canUser instead of hasAccess method.

@Sztig Sztig requested a review from a team April 15, 2025 13:29
@konradoboza konradoboza requested a review from a team April 15, 2025 13:34
@konradoboza konradoboza requested a review from a team April 15, 2025 13:46
@@ -226,7 +226,7 @@ private function getLocationPermissionRestrictions(Location $location): array
'restrictedLanguageCodes' => $createLimitationsValues[Limitation::LANGUAGE],
],
'edit' => [
'hasAccess' => $lookupUpdateLimitationsResult->hasAccess(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked other uses of this method? If it does not work correctly, it should be fixed, or all usage should be replaced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to investigate this one, we have another variable lookupUpdateLimitationsResult thats also not working correctly here, I will come back here once I have done some test.

return $this->permissionResolver->canUser(
'content',
'edit',
$content
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to pass any targets here as a fourth argument?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants