Uploaded image for project: 'COmanage'
  1. COmanage
  2. CO-2724

Bad interaction of ChangelogBehavior and threaded queries impacts adding CO Person Role

    XMLWordPrintable

Details

    Description

      I operate a 4.3.1 deployment that is multi-tenant and each tenant has multiple COUs with the COUs having substantial parent-child relationships. The deployment has been in production for a couple of years.

      For this deployment the cm_cous table has, in some complicated way, evolved into a state where queries on it using 'threaded' as the query type results in the incorrect set of rows being returned. I mention this because reproducing this issue is quite difficult.

      The only place where the 4.x code base uses a query of type 'threaded' is in Controller/CoPersonRolesController.php, specifically in the code that computes the view variable vv_available_cous which is used when editing/adding a CoPersonRole to populate the drop down chooser. The code is

      $cous = $this->CoPersonRole->Cou->find('threaded', $args); 

      I suspect this is a bad interaction between the 'threaded' query and ChangelogBehavior. 

      For this deployment and a particular CO, the value for $cous above is

      (
          [0] => Array
              (
                  [Cou] => Array
                      (
                          [id] => 12
                          [co_id] => 5
                          [name] => Test
                          [description] => 
                          [parent_id] => 11
                          [lft] => 8
                          [rght] => 9
                          [created] => 2021-02-16 00:10:30
                          [modified] => 2021-02-16 00:10:30
                          [cou_id] => 
                          [revision] => 1
                          [deleted] => 
                          [actor_identifier] => http://cilogon.org/serverI/users/1088
                      )            [children] => Array
                      (
                      )        ))
       

      If I replace the 'threaded' query with a simple 'all' and change nothing else then the value for $cous is

      (
          [0] => Array
              (
                  [Cou] => Array
                      (
                          [id] => 12
                          [co_id] => 5
                          [name] => Test
                          [description] => 
                          [parent_id] => 11
                          [lft] => 8
                          [rght] => 9
                          [created] => 2021-02-16 00:10:30
                          [modified] => 2021-02-16 00:10:30
                          [cou_id] => 
                          [revision] => 1
                          [deleted] => 
                          [actor_identifier] => http://cilogon.org/serverI/users/1088
                      )        )    [1] => Array
              (
                  [Cou] => Array
                      (
                          [id] => 66
                          [co_id] => 5
                          [name] => TSI-Manager
                          [description] => TSI Managers
                          [parent_id] => 75
                          [lft] => 64
                          [rght] => 65
                          [created] => 2022-08-03 04:52:20
                          [modified] => 2023-08-03 02:26:25
                          [cou_id] => 
                          [revision] => 9
                          [deleted] => 
                          [actor_identifier] => http://cilogon.org/serverA/users/13976096
                      )        )
      <snip> 

      That is, replacing 'threaded' with 'all' causes $cous to be the expected and correct set of COUs for this CO.

      Note that this change also makes the dropdown work–no other change is necessary. Whatever special format 'threaded' is supposed to return appears to not be necessary or unique/distinct from that returned by an 'all' query.

       

       

      Attachments

        Activity

          People

            scott.koranda@at.internet2.edu Scott Koranda (uwm.edu/illinois.edu)
            scott.koranda@at.internet2.edu Scott Koranda (uwm.edu/illinois.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: