Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Andrey Yeremenko
Permission checker is null in LoginPostAction
November 17, 2012 5:53 AM
Answer

Andrey Yeremenko

Rank: New Member

Posts: 6

Join Date: July 26, 2011

Recent Posts

Hi guys,

I got a problem.

I need to get several expandos after logging in.

So I tried to do it in
1 LoginPostAction

I get from factory ExpandoBridge instance and then tried to get needed expando by
1expandoBridge.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:

 1
 2package com.liferay.portal.security.permission;
 3...
 4/**
 5 * @author Brian Wing Shun Chan
 6 */
 7public class PermissionThreadLocal {
 8    public static PermissionChecker getPermissionChecker() {
 9        return _permissionChecker.get();
10    }
11    .....
12    private static ThreadLocal<PermissionChecker> _permissionChecker =
13        new AutoResetThreadLocal<PermissionChecker>(
14            PermissionThreadLocal.class + "._permissionChecker");
15
16}


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



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
RE: Permission checker is null in LoginPostAction
November 28, 2012 8:47 AM
Answer

Andrey Yeremenko

Rank: New Member

Posts: 6

Join Date: July 26, 2011

Recent Posts

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
RE: Permission checker is null in LoginPostAction
November 28, 2012 9:17 AM
Answer

Andrey Yeremenko

Rank: New Member

Posts: 6

Join Date: July 26, 2011

Recent Posts

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.