mobilemindtec opened a new issue, #14099:
URL: https://github.com/apache/grails-core/issues/14099
### Issue description
Hi,
I'm upgrading a project to version 7.0.0-M3 and I noticed that a taglib that
is called in the main layout doesn't work correctly. For example:
```groovy
class AuthService {
def springSecurityService // injected by Spring
def getCurrRoles() {
def auth = springSecurityService.authentication
def roles = auth?.authorities?.collect { it.authority } ?: []
log.info "roles = $roles"
roles
}
def getUser(){
def principal = springSecurityService.getPrincipal()
if(!principal || "anonymousUser".equals(principal.toString())){
return null
}
User.findWhere(username:
springSecurityService.getPrincipal().username)
}
}
class AuthTagLib {
static namespace = "auth"
def authService
def roles = { attrs, body ->
out << authService.currRoles
}
def user = { attrs, body ->
out << authService.user
}
}
```
When I call (logged in) `<auth:roles />` `<auth:user />` from any page the
values return correctly, but when I call it from `main.gsp` it returns a
empty list and null respectively. In version 6 the taglib responded correctly.
Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]