I want to show the profile of the current user.
I have this
Link:
<g:link controller="User" action="show" id=>Profile</g:link>
how I do it
I want to show the profile of the current user.
I have this
Link:
<g:link controller="User" action="show" id=>Profile</g:link>
how I do it
If you want the current user then you should probably not rely on passing the user id in the URL but rather use whatever mechanism your security layer provides to get the logged in user id in the controller.
If your controller simply shows the profile for whichever user id it was passed in the URL then a malicious attacker could modify the URL and view the profile of a different user. To protect against that you'd need to compare the id from the URL with the one your security framework thinks is logged in, at which point you may as well just use the one the framework gave you in the first place.
Send the Profile ID of the Current User as an attribute value of
<g:link controller="User" action="show" id="${currentUser.id}">Profile</g:link>