I am working on one feature in Liferay 6 and I want it, to be accessible only for Site Owner. I have big problem how to get if user is Site Owner. I can get if user is Administrator using this
if (RoleServiceUtil.hasUserRole(user.getUserId(), companyId,
"Administrator", true)) {
//do something
}
When I use Site Owner instead of Administrator, then I get this message Site Owner is not a regular role
Thanks for help
-Roman
The simplest way is to use permissionChecker
.
First you'll need to include the a TagLib like so:
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
Then you can place some basic variables on the page (one of which is permissionChecker
) like so:
<liferay-theme:defineObjects />
Then you can simply call,
permissionChecker.isGroupOwner()
or permissionChecker.isGroupAdmin()