Skip to content
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

Check if user has access to its profile before generating link #1620

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

jordisala1991
Copy link
Member

@jordisala1991 jordisala1991 commented Apr 2, 2023

Subject

I am targeting this branch, because this is bc.

Closes #1591.

Changelog

### Fixed
- Generate the profile link only if the logged user has access to it (edit or show permissions)

<div class="pull-left">
<a href="{{
sonata_user.userAdmin.isGranted('EDIT', app.user) ?
sonata_user.userAdmin.hasAccess('edit', app.user) ?
Copy link
Member Author

Choose a reason for hiding this comment

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

The isGranted I didnt like it a lot, looks like the normal is_granted from symfony but does a different thing. hasAccess looks cleaned, also uses same name 'edit' used in generate route. wdyt @VincentLanglet ?

Copy link
Member

Choose a reason for hiding this comment

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

Seems ok

@VincentLanglet VincentLanglet merged commit 28aec33 into 5.x Apr 3, 2023
@VincentLanglet VincentLanglet deleted the jordisala1991-patch-1 branch April 3, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The profile link in user_block.html.twig is always displayed, even if user is not allowed to view the profile.
2 participants