Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-8776

Can't filter task list based on group name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 7.20.0.Final, 7.25.0.Final
    • KieServer
    • None

    Description

      As per the current code implementation, I can't be able to filter task list based on user group passed in the kie server pot-owners API.

      I looked at the code, we are not using the group name which passed in the API while filtering task list,
      Current Code:
      @Override
      public List getTasksAssignedAsPotentialOwner(String userId, List groupIds, QueryFilter filter)

      { Map<String, Object> params = new HashMap<String, Object>(); params.put("userId", userId); params.put("groupIds", mergeLists(groupIds, getCallbackUserRoles(userGroupCallback, userId))); applyQueryContext(params, filter); applyQueryFilter(params, filter); return (List) commandService .execute(new QueryNameCommand<List>("TasksAssignedAsPotentialOwnerWithGroups", params)); }

      public static List getCallbackUserRoles(UserGroupCallback userGroupCallback, String userId) {
      List roles = userGroupCallback != null ? userGroupCallback.getGroupsForUser(userId) : new ArrayList<>();
      if (roles == null || roles.isEmpty())

      { roles = new ArrayList<>(); roles.add(""); }

      return roles;
      }

      But the actual code will be look like below,

      @Override
      public List getTasksAssignedAsPotentialOwner(String userId, List groupIds, QueryFilter filter) {
      Map<String, Object> params = new HashMap<String, Object>();
      // params.put("groupIds", mergeLists(groupIds, getCallbackUserRoles(userGroupCallback, userId)));
      if (groupIds == null || groupIds.isEmpty())

      { params.put("userId", userId); params.put("groupIds", getCallbackUserRoles(userGroupCallback, userId)); }

      else
      params.put("groupIds", filteredUserGroups(groupIds, getCallbackUserRoles(userGroupCallback, userId)));
      applyQueryContext(params, filter);
      applyQueryFilter(params, filter);
      return (List) commandService
      .execute(new QueryNameCommand<List>("TasksAssignedAsPotentialOwnerWithGroups", params));
      }

      private List filteredUserGroups(List groupIds, List callbackUserRoles) {
      List data = new ArrayList();
      for (String groupId : groupIds)

      { if (callbackUserRoles.contains(groupId)) data.add(groupId); }

      return data;
      }

      Attachments

        Activity

          People

            swiderski.maciej Maciej Swiderski (Inactive)
            abhay2904 Abhay Meshram (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: