留言板
Cannot retrieve custom user variables
Riley Pickerl,修改在11 年前。
Cannot retrieve custom user variables
Junior Member 帖子: 50 加入日期: 13-1-10 最近的帖子
Hello,
I am having a problem retrieving a custom variable I have set for users. I have set a custom user variable with key "addressBookNumber", and assigned the approriate values to the users.
In my code I have:
This works and returns the result for when the admin user is logged in. However with a different user (one with less permissions) this code throws an exception:
javax.portlet.PortletException: java.lang.NullPointerException
Is there some restriction on who can grab the values, how do I get around this?
Thanks,
I am having a problem retrieving a custom variable I have set for users. I have set a custom user variable with key "addressBookNumber", and assigned the approriate values to the users.
In my code I have:
try {
User currentUser = PortalUtil.getUser(request);
String addressBookNumber = currentUser.getExpandoBridge().getAttribute("addressBookNumber").toString();
} catch ...
This works and returns the result for when the admin user is logged in. However with a different user (one with less permissions) this code throws an exception:
javax.portlet.PortletException: java.lang.NullPointerException
Is there some restriction on who can grab the values, how do I get around this?
Thanks,
David H Nebinger,修改在11 年前。
RE: Cannot retrieve custom user variables
Liferay Legend 帖子: 14916 加入日期: 06-9-2 最近的帖子
Could be many reasons for the NPE... Perhaps it did not return the currentUser, perhaps there's no result from getExpandoBridge(), or no result from getAttribute().
What it boils down to is that the user does not have permissions on the expando item. You'll have to grant privileges on the custom field so others can access them.
What it boils down to is that the user does not have permissions on the expando item. You'll have to grant privileges on the custom field so others can access them.
Riley Pickerl,修改在11 年前。
RE: Cannot retrieve custom user variables
Junior Member 帖子: 50 加入日期: 13-1-10 最近的帖子
It was the permissions, thanks!