I've been working on access control.So,In our liferay portlets,how can I get all permissions of a user,I've achieved getting roles of a user by
FacesContext facesContext = FacesContext.getCurrentInstance();
PortletRequest request = (PortletRequest) facesContext
.getExternalContext().getRequest();
User user = (User) request.getAttribute(WebKeys.USER);
List<Role> roles = new ArrayList<Role>();
roles.addAll(RoleLocalServiceUtil.getUserRoles(user.getUserId()));
roles.addAll(RoleLocalServiceUtil.getUserRelatedRoles(user.getUserId(), user.getGroupIds()));
But I cant find any thing by which I can find if the given user has view/configuration/etc permissions with respect to the portlets.getResourceResourcePermissions
gives me the permission but by ids,How can I find permissions with permission name i.e view/config/update
liferay 6.2
You can check if user has that permission one by one in the portlet.
ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
long groupId = themeDisplay.getScopeGroupId();
String name = (String)request.getAttribute(WebKeys.PORTLET_ID);
String primKey = portletDisplay.getResourcePK();
boolean view = permissionChecker.hasPermission(groupId, name, primKey, ActionKeys.VIEW);
boolean congiguration = permissionChecker.hasPermission(groupId, name, primKey, ActionKeys.CONFIGURATION);
boolean update = permissionChecker.hasPermission(groupId, name, primKey, ActionKeys.UPDATE);