Mittwoch, 30. März 2016

Reading custom attribute from hook Liferay.

Some time you want to read custom attribute from hook or from function which was called by some ajax request. You will get null value when you will try to access these attributes through expand bridge unless you set the permission first.  Some thing similar as given below

final Role adminRole = RoleLocalServiceUtil.getRole(user.getCompanyId(), "Administrator");
final List<User> adminUsers =UserLocalServiceUtil.getRoleUsers(adminRole.getRoleId());
PrincipalThreadLocal.setName(adminUsers.get(0).getUserId());
final PermissionChecker permissionChecker =PermissionCheckerFactoryUtil.create(adminUsers.get(0));

Keine Kommentare:

Kommentar veröffentlichen