Uploaded image for project: 'Syncope'
  1. Syncope
  2. SYNCOPE-667

simplification of admin roles filter query used in search

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Pending Closed
    • Affects Version/s: 1.2.4
    • Fix Version/s: 1.2.5
    • Component/s: core
    • Labels:
      None

      Description

      As discussed on the dev mailing list [1], I think the query generated in SubjectSearchDAOImpl.getAdminRolesFilter() to determine the users which have roles not in adminRoles can be simplified for type==SubjectType.USER.

      Currently generated query: (for type==USER and adminRoles={1,2}):

      SELECT syncopeUser_id AS subject_id FROM Membership M1 WHERE syncopeRole_id IN
          (SELECT syncopeRole_id FROM Membership M2 WHERE M2.syncopeUser_id=M1.syncopeUser_id AND syncopeRole_id NOT IN
                 (SELECT id AS syncopeRole_id FROM SyncopeRole WHERE id=1 OR id=2)
          ) 
      

      Suggested simplification:

      SELECT syncopeUser_id AS subject_id FROM Membership WHERE syncopeRole_id NOT IN (
                                                     SELECT id AS syncopeRole_id FROM SyncopeRole WHERE id=1 OR id=2
                                         ) 
      

      In addition, the test coverage of the admin roles filter mechanism used in search should be improved.

      [1] http://syncope-dev.1063484.n5.nabble.com/getAdminRolesFilter-query-td5716932.html

        Attachments

          Activity

            People

            • Assignee:
              wimmelg Guido Wimmel
              Reporter:
              wimmelg Guido Wimmel
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: