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

Add standard methods to retrieve full paths of standard attributes

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.4.0
    • Fix Version/s: None
    • Component/s: API, provisioning
    • Labels:
      None

      Description

      Getting the AttributeDefName for an attribute, or sometimes even calculating the name of it to look it up, varies for different attributes. Sometimes, a getter method returns the AttributeDefName directly. Sometimes it returns a string, and another query is needed to fetch the object. Sometimes, there is no method to return the full attribute path, but there is a method to return the folder name, and static fields for all the attribute names, so the path string can be calculated. In a few cases, there is nothing defined, so the caller needs to assume a hard-coded path.

       

      Attribute sets with standard methods:

      import edu.internet2.middleware.grouper.app.attestation.GrouperAttestationJob
      GrouperAttestationJob.retrieveAttributeDefNameValueDef()
      GrouperAttestationJob.retrieveAttributeDefNameCalculatedDaysLeft()
      GrouperAttestationJob.retrieveAttributeDefNameDateCertified()
      ...
      

      This is the gold standard, as the callers don't need multiple calls to get the AttributeDefName, or compute the paths. Attribute classes covered in this include:

      • Attestation
      • Entities
      • Deprovisioning
      • GrouperUserDataUtils
      • LoaderLDAPUtils
      • Example hook MembershipOneInFolderMaxHook
      • Permission limits

      Attribute sets with string methods returning full path

      Here, methods return the full path of attributes, and then another call to AttributeDefNameFinder(name) returns the AttributeDefName. This requires one extra call, but at least doesn't require paths to be computed.

      • External Subject Invite (a few attributes do have an AttributeDefName method)
      • RuleUtils (a few attributes do have an AttributeDefName method)

      Attribute sets with a folder path method, and static fields for attribute extensions

      Here, there is one method to get the folder name. Then, the caller must construct a string with folder + ":" + static string attribute name

      • Grouper Attribute Loader (but I could not find a static field for the base attribute, so a hard-coded ":attributeLoader" must be used in callers?) (also, the stem name method is in the GrouperCheckConfig class, not a loader class)
      • Instrumentation
      • Loader Metadata (stem method name is in GrouperCheckConfig class)
      • Object types

      pspng

      For PSPNG, the attribute extensions provision_to and do_not_provision_to are in static fields. But the stem paths are always calculated in private methods, so there is no standard way to retrieve them. So the only way to determine a pspng attribute def name is to use the same calculations:

      GrouperConfig.retrieveConfig().propertyValueString("grouper.rootStemForBuiltinObjects", "etc") + ":pspng:" + Provisioner.PROVISION_TO_ATTRIBUTE

      This should be refactored into a public method to save calculations as well as caller assumptions on hardcoded names. It would be preferable to put this in a grouper package and not the pspng jar, since the attribute will exist even when called from an app where the pspng jar isn't loaded.

      SQL Loader

      In contrast to LDAP Loader, SQL Loader attributes are legacy group types. The way to get these definitions is by either GroupTypeFinder (which is marked deprecated even though it's the only way to access it without hardcoding a full path), or a GrouperDAOFactory chain.

      GroupTypeFinder.find("grouperLoader").getAttributeDefName()  //etc:legacy:attribute:legacyGroupType_grouperLoader
       
      GrouperDAOFactory.getFactory().getAttributeDefName().findLegacyAttributeByName(attributeName, false)
       
      //where attributeNames are:
      GrouperLoader.GROUPER_LOADER_AND_GROUPS
      GrouperLoader.GROUPER_LOADER_DB_NAME
      GrouperLoader.GROUPER_LOADER_GROUP_QUERY
      GrouperLoader.GROUPER_LOADER_GROUP_TYPES
      GrouperLoader.GROUPER_LOADER_GROUPS_LIKE
      GrouperLoader.GROUPER_LOADER_INTERVAL_SECONDS
      GrouperLoader.GROUPER_LOADER_PRIORITY
      GrouperLoader.GROUPER_LOADER_QUARTZ_CRON
      GrouperLoader.GROUPER_LOADER_QUERY
      GrouperLoader.GROUPER_LOADER_SCHEDULE_TYPE
      GrouperLoader.GROUPER_LOADER_TYPE
      

        Attachments

          Activity

            People

            • Assignee:
              mchyzer Chris Hyzer
              Reporter:
              cer28 Chad Redman
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: