Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-5493

grouperExternal source doesn't have real properties, so diagnostics shows properties from a random source

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 4.14.0, 5.11.0
    • 2.5.23
    • UI
    • None

    Description

      There is some special logic in the SubjectSourceDiagnostics class. Instead of getting the source id directly from subject.properties, it loops through every subject property trying to match subjectApi.source.*.id values until one matches the config name. I don't understand it, other than the comment that it has to do with configName vs. sourceId. The matcher stores potential match in a variable in a higher scope, so that if nothing matches configId to sourceId, the result is the last source that matched the pattern.

       

      The grouperExternal source in particular shows this, since it is a special source not based on properties. Since all the other sources match the id pattern but none match the source id, it ends up being a random one. This seems to only show up in the SOURCE CONFIGURATION section of the diagnostics, making it appear like an ldap or other source.

       

      edu.internet2.middleware.grouper.grouperUi.serviceLogic.SubjectSourceDiagnostics

              String sourceConfigId = null;
              Pattern sourceIdConfigPattern = Pattern.compile("^subjectApi\\.source\\.([^.]+)\\.id$");
              
              for (String configName : SubjectConfig.retrieveConfig().propertyNames()) {
                
                //  # generally the <configName> is the same as the source id.  Generally this should not have special characters
                //  # subjectApi.source.<configName>.id = sourceId
        
                Matcher matcher = sourceIdConfigPattern.matcher(configName);
                if (matcher.matches()) {
                  sourceConfigId = matcher.group(1);
                  if (StringUtils.equals(sourceId, SubjectConfig.retrieveConfig().propertyValueString("subjectApi.source." + sourceConfigId + ".id"))) {
                    break;
                  }
                }
      

       

      Attachments

        Activity

          People

            shilen.patel@at.internet2.edu Shilen Patel
            chad.redman.3@at.internet2.edu Chad Redman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: