I would like to insert the ScreenName variable in my form created directly from the liferay panel, as if it were a non-editable field. In this way I will have in the summary who makes the request and can easily approve. I have already added the variable on the workflow but it needs to be there also inside the form.
Asked
Active
Viewed 76 times
1 Answers
2
If I understand you right, you want to verify the identity of the User who is submitting the form. There are several better ways to do that:
Via the PortalUtil:
User user = PortalUtil.getUser(request);
Instead of the PortalUtil you could also use an OSGi Reference of the Portal Service (what I recommend):
@Reference
private Portal portal;
// you could replace the PortletRequest by a HttpServletRequest if needed
private void someMethod(PortletRequest request) {
User user = portal.getUser(request);
}
Or you could take a look possibilities shown in this answer.
If you still want to use the variable it depends on what you use to render your form. In case you use JSP it would be something like this:
<input type="hidden" name="nameoftheinputfield" value="${user.screenName}">
Be aware that this can be manipulated easily.

qutax
- 828
- 1
- 11
- 20
-
I have only LAR from Liferay Front-end by export function – DevOkAnd Oct 27 '18 at 08:31
-
If you don't have access to the code, there is no way to do this. Lar files merely hold the apps data but not the app itself. You can open the file yourself. It's nothing more than an archive holding several xml files and a directory structure representing the group specific configurations. – qutax Oct 30 '18 at 06:58