Impersonating friendly URLsImpersonating friendly URLshttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1173329332024-03-28T23:42:52Z2024-03-28T23:42:52ZRE: Impersonating friendly URLsJan Tošovskýhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1173415152019-10-02T16:05:42Z2019-10-02T16:05:42ZI fixed it. Originally this was fix for another issue, but both turned out to be related.<br />My resourceAction should return PNG attachment, but the content was written directly to the page as characters. After further analysis I found this binary content is wrapped by senna container so I finally found the root cause.<br />My links look like this: <a href=" .../attachment/2749384?doAsUserId=xRdO8Wv72X5YHWlYGO">. However, they are internally processed by SennaJS, which, in my case, breaks the original functionality.<br />So with the help of <a href="https://stackoverflow.com/questions/41288039/how-can-i-disable-sennajs-spa-in-liferay-7">https://stackoverflow.com/questions/41288039/how-can-i-disable-sennajs-spa-in-liferay-7 </a>I changed the link to <a href=" .../attachment/2749384?doAsUserId=xRdO8Wv72X5YHWlYGO" data-senna-off="true"><br />It not only fixed that attachment issue, but also impersonating one.Jan Tošovský2019-10-02T16:05:42ZRE: Impersonating friendly URLsJan Tošovskýhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1173371382019-10-02T14:19:13Z2019-10-02T14:19:13ZHi Olaf, a good point. I checked this in old 6.2 version and it works as expected there. Now I am on 7.2 GA1. So this seems to be a regression. I'll test this on some core friendly URLs if it is really global issue or just a problem of my portlet.Jan Tošovský2019-10-02T14:19:13ZRE: Impersonating friendly URLsOlaf Kockhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1173380622019-10-02T09:04:58Z2019-10-02T09:04:58Z<div class="quote-title">Jan Tošovský:</div><blockquote><br />I am trying to pass doAsUserId param to my friendly URL <br /></blockquote>I probably can't help you directly, but it might help to mention the exact Liferay version. And if there's a newer GA on your major version, try if it's an issue that was already fixed.Olaf Kock2019-10-02T09:04:58ZImpersonating friendly URLsJan Tošovskýhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1173329322019-10-01T19:09:00Z2019-10-01T19:09:00Z<html><head></head><body>I am trying to pass doAsUserId param to my friendly URL .../attachment/2749384?doAsUserId=xRdO8Wv72X5YHWlYGO, but it is apparently not passed upstream.<br>When my route is processed and enters the serveResource() method, the user retrieved from resourceRequest is not that impersonated user, but real one. <br><pre><code><route>
&nbsp;&nbsp; <pattern>/attachment/{attachmentId:[^/]+}</pattern>
&nbsp;&nbsp; <implicit-parameter name="p_p_lifecycle">2</implicit-parameter>
&nbsp;&nbsp; <implicit-parameter name="p_p_cacheability">cacheLevelPage</implicit-parameter>
&nbsp;&nbsp; <implicit-parameter name="mvcPath">/attachment.jsp</implicit-parameter&a