Uploaded image for project: 'MidPoint'
  1. MidPoint
  2. MID-4311

QueryBuilder filter functionality regression

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: 3.7
    • Component/s: Prism
    • Labels:
      None

      Description

      I have found a possible recent regression of search with QueryBuilder.

      This code in groovy expression worked for us previously and found appropriate users:

      ownerRoleOid = basic.stringify(ownerObject.getOid())
      ObjectFilter userFilter = QueryBuilder.queryFor(UserType.class, midpoint.getPrismContext()).item(UserType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF).ref(ownerRoleOid).buildFilter();

      This is current debug serialization of created filter:

      userFilter: REF:
      PATH: assignment/targetRef
      DEF: PRD:

      {.../common/common-3}targetRef {.../common/common-3}

      ObjectReferenceType[0,1],RAM
      VALUE:
      PRV(oid=3015a566-574a-4e1e-b3a9-0153d795b595, targetType=null)

      This is a prove that we really have such user:

      ...
      <assignment id="13">
      <metadata>
      ...
      </metadata>
      <targetRef oid="3015a566-574a-4e1e-b3a9-0153d795b595"
      relation="org:default"
      type="c:RoleType"><!-- SCHVALOVATEL_ROLE_XXX --></targetRef>
      <activation>
      <effectiveStatus>enabled</effectiveStatus>
      </activation>
      </assignment>
      ...

      Also I can easily modify the search so that it works as expected by using role membership ref instead of assignment:

      ownerRoleOid = new PrismReferenceValue(ownerObject.getOid(), RoleType.COMPLEX_TYPE); ownerRoleOid.setRelation(SchemaConstants.ORG_DEFAULT);
      ObjectFilter userFilter = QueryBuilder.queryFor(UserType.class, midpoint.getPrismContext()).item(UserType.F_ROLE_MEMBERSHIP_REF).ref(ownerRoleOid).buildFilter();

      Note that in this snippet I have also modified the value to contain also the relation, but assignment search don't work for both variants - string oid and prism reference value with relation. This snippet produces this search:

      userFilter: REF:
      PATH: roleMembershipRef
      DEF: PRD:

      {.../common/common-3}roleMembershipRef {.../common/common-3}

      ObjectReferenceType[0,-1],RAM,oper
      VALUE:
      PRV(oid=3015a566-574a-4e1e-b3a9-0153d795b595, targetType=

      {.../common/common-3}

      RoleType, relation=

      {.../common/org-3}

      default)

      In query playground both filters works as expected.

        Attachments

          Activity

            People

            • Assignee:
              frantisek.rezac František Řezáč
              Reporter:
              frantisek.rezac František Řezáč
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: