Reputation: 3401
This is a sample code for the getCurrentUser() method in Spring Security service.
class SomeController {
def springSecurityService
def someAction() {
def user = springSecurityService.currentUser
}
}
How do you get the id of the logged in user and use it in this <g:link action="show" controller="User" id="">Show Profile</g:link>
Upvotes: 0
Views: 173
Reputation: 75671
In general it's available in the "principal", which is an instance of GrailsUser
, so the most efficient way is springSecurityService.principal.id
Upvotes: 3