core
core copied to clipboard
PersonaTool forcePersona() method doesn't work in Front End
Possible Solution
See hotfix.
Known Workarounds
Use Rules Engine.
Steps to Reproduce (for bugs)
- Create a Page + Simple Widget and paste this code:
Visitor: $visitor
#set( $results = $dotcontent.pull( "+contentType:persona +persona.keyTag:FirstTimeInvestor", 1, "modDate" ) )
#foreach( $persona in $results )
<br>
<br>
Persona Found: $persona.keyTag
$personatool.forcePersona( $persona.identifier )
#end
<br>
<br>
Visitor: $visitor
- Hit the page in front end.
Context
You will see the $personatool.forcePersona( $persona.identifier ) line in the Front End, that means that there is an error executing that line.
If you debug the code you will see this exception:
DotSecurityException: User:null does not have permissions to Contentlet:3ffaff2c-3b82-4bd6-8622-ec2637cc0ac6
That is because in this line we try to find the Persona content using the user logged. BUT we are sending algo the respectFrontendRoles flag as false. This will prevent the logic for anonymous roles to run.
Your Environment
- dotCMS version used: 3.7.1 and latest master
Passed QA. $personatool.forcePersona( $persona.identifier ) line is not showing anymore in the Front End
Tested on master branch Mac OS 10.10 / Postgres 9.6.6 / Chrome v64.0.3282.167 / Tomcat 8 / Java 8.6