protected int authenticateOmniadmin( long companyId, String emailAddress, String screenName, long userId) throws Exception { // Only allow omniadmin if Liferay password checking is enabled if (PropsValues.AUTH_PIPELINE_ENABLE_LIFERAY_CHECK) { if (userId > 0) { if (OmniadminUtil.isOmniadmin(userId)) { return SUCCESS; } } else if (Validator.isNotNull(emailAddress)) { try { User user = UserLocalServiceUtil.getUserByEmailAddress(companyId, emailAddress); if (OmniadminUtil.isOmniadmin(user.getUserId())) { return SUCCESS; } } catch (NoSuchUserException nsue) { } } else if (Validator.isNotNull(screenName)) { try { User user = UserLocalServiceUtil.getUserByScreenName(companyId, screenName); if (OmniadminUtil.isOmniadmin(user.getUserId())) { return SUCCESS; } } catch (NoSuchUserException nsue) { } } } return FAILURE; }
public boolean isOmniadmin() { if (omniadmin == null) { omniadmin = Boolean.valueOf(OmniadminUtil.isOmniadmin(getUserId())); } return omniadmin.booleanValue(); }
private boolean _isOmniAdmin(HttpServletRequest request) { User user = null; try { user = PortalUtil.getUser(request); } catch (Exception e) { } if ((user != null) && OmniadminUtil.isOmniadmin(user.getUserId())) { return true; } else { return false; } }