public static String[] getUserGroups() throws Exception { Object[] objGroupIds = getGroupHandler().findGroupsOfUser(UserHelper.getCurrentUser()).toArray(); String[] groupIds = new String[objGroupIds.length]; for (int i = 0; i < groupIds.length; i++) { groupIds[i] = ((GroupImpl) objGroupIds[i]).getId(); } return groupIds; }
public static User getCurrentUserObject() throws Exception { try { ConversationState state = ConversationState.getCurrent(); User user = (User) state.getAttribute(CacheUserProfileFilter.USER_PROFILE); if (user == null) { user = UserHelper.getOrganizationService().getUserHandler().findUserByName(getCurrentUser()); } return user; } catch (Exception e) { return null; } }
public static String checkValueUser(String values) throws Exception { String errorUser = null; if (values != null && values.trim().length() > 0) { String[] userIds = values.split(","); for (String str : userIds) { str = str.trim(); if (str.indexOf("$") >= 0) str = str.replace("$", "$"); if (str.indexOf("/") >= 0) { if (!UserHelper.hasGroupIdAndMembershipId(str)) { if (errorUser == null) errorUser = str; else errorUser = errorUser + ", " + str; } } else { // user if ((getUserHandler().findUserByName(str) == null)) { if (errorUser == null) errorUser = str; else errorUser = errorUser + ", " + str; } } } } return errorUser; }
public static boolean isAnonim() throws Exception { String userId = UserHelper.getCurrentUser(); if (userId == null) return true; return false; }
public static String getCurrentUser() throws Exception { return UserHelper.getCurrentUser(); }