List of usage examples for com.liferay.portal.kernel.security.permission PermissionChecker isCompanyAdmin
public boolean isCompanyAdmin(long companyId);
true if the user is an administrator of the company. From source file:eu.gerhards.liferay.services.angular.service.impl.AngularTeamServiceImpl.java
License:Open Source License
protected void crossCompanyCheck(long targetCompany) throws PortalException { long userCompanyId = this.getGuestOrUser().getCompanyId(); PermissionChecker permissionChecker = getPermissionChecker(); if (permissionChecker.isSignedIn()) { if (userCompanyId != targetCompany && (!permissionChecker.isOmniadmin() || !permissionChecker.isCompanyAdmin(targetCompany))) { throw new PrincipalException.MustBeOmniadmin(this.getGuestOrUserId()); }/*from w w w .j a va2 s . c o m*/ } else { throw new PrincipalException.MustBeAuthenticated(this.getGuestOrUserId()); } }