Foros de discusión

Permission checker is null in LoginPostAction

Andrey Yeremenko, modificado hace 11 años.

Permission checker is null in LoginPostAction

New Member Mensajes: 6 Fecha de incorporación: 26/07/11 Mensajes recientes
Hi guys,

I got a problem.

I need to get several expandos after logging in.

So I tried to do it in
 LoginPostAction

I get from factory ExpandoBridge instance and then tried to get needed expando by
expandoBridge.getAttribute(myAttribute)

But I got null. I dug a little and could see that it is because of exception - PermissionChecker is not created yet.

I can see that it is got from:


package com.liferay.portal.security.permission;
...
/**
 * @author Brian Wing Shun Chan
 */
public class PermissionThreadLocal {
	public static PermissionChecker getPermissionChecker() {
		return _permissionChecker.get();
	}
	.....
	private static ThreadLocal<permissionchecker> _permissionChecker =
		new AutoResetThreadLocal<permissionchecker>(
			PermissionThreadLocal.class + "._permissionChecker");

}
</permissionchecker></permissionchecker>


and its instance is somehow self-created because of
private static ThreadLocal<permissionchecker> _permissionChecker = new ... </permissionchecker>



So how can I get expando after logging in without additional requests by ajax to server?
Or how can I force creation of PermissionChecker?
Andrey Yeremenko, modificado hace 11 años.

RE: Permission checker is null in LoginPostAction

New Member Mensajes: 6 Fecha de incorporación: 26/07/11 Mensajes recientes
Hi guys again!


So I worked around it in next way:
1) I created for session some flag in LoginPostAction.
2) Overrided ROOT/html/common/themes/bottom-ext.jsp
3) Where I was looking for this flag and if it was, I got expando by expandoBridge.getAttribute(myAttribute).

It was fine last time when I was at job place, but I was in vocation last week.
Now I can see that PermissionChecker is null even here!!!!emoticonemoticon

What is the matter?
How can I resolve this?
Andrey Yeremenko, modificado hace 11 años.

RE: Permission checker is null in LoginPostAction

New Member Mensajes: 6 Fecha de incorporación: 26/07/11 Mensajes recientes
The thing was next.

This workoraound works but you have to set permissions as VIEW for concrete liferay user.
It was not working for me because of new database and I forgot about setting correct rights.