예제 #1
0
 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;
 }
예제 #2
0
 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;
   }
 }
예제 #3
0
  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("$", "&#36");

        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;
  }
예제 #4
0
 public static boolean isAnonim() throws Exception {
   String userId = UserHelper.getCurrentUser();
   if (userId == null) return true;
   return false;
 }
예제 #5
0
 public static String getCurrentUser() throws Exception {
   return UserHelper.getCurrentUser();
 }