Overview

GSH templates will require people to write GSH.  Currently when considering Grouper's GSH "api", we have "built in" commands, e.g. getGroups(name). These have downsides (they can't get enhanced inputs without overloading the method).  Those will be maintained going forward but are deprecated for new scripts.  

We have been making more modern "method chained" classes to do Grouper primitives (e.g. create group), but the GSH documentation needs to be updated.  So we will take this opportunity (as of March 2021) to build out, document, and test the new recommended GSH API operations for Grouper.  Here is a first pass at a doc that lists the tasks with priority.   


For finders (retrieve) and savers (insert/update/delete):

See also GrouperShell (gsh) Group insert / update / delete

  • Method chaining (allows arbitrary arguments, eliminates method overloading/deprecation)

    Group group = new GroupSave().assignName("a:b:c").assignCreateParentStemsIfNotExist(true).assign....().save();

    Note the "GroupSave" object could have other results (e.g. if something was actually changed in the database or if it was already correct)

  • Secure methods, or option to not be secure (i.e. if secure sees if current Grouper session has ability to make change or query)
    • It is not necessary to pass in a GrouperSession
  • Replace all settings: keeps track of what methods were called and can only edit what was changed (default true)

    // If the group exists and has a description, it will be removed
    Group group = new GroupSave().assignName("a:b:c").save();
    
    // If the group exists and has a description, it will not be changed
    Group group = new GroupSave().assignName("a:b:c").assignReplaceAllSettings(false).save();
    
    

Example script using method chaining (note this is not a standalone script, some variables are pre-defined)

  // Assign privs for admins on folder
  new PrivilegeGroupInheritanceSave().assignStem(workingGroupFolder).addPrivilegeName("admin").assignSubject(adminsGroup.toSubject()).save();
  
  // Assign attestation on working group folder
  new AttestationStemSave().assignStemName(workingGroupFolderName).assignDaysUntilRecertify(90).save();
   
  // sympa folder
  if (gsh_input_isSympa) {
    Stem sympaFolder = new StemSave().assignName(sympaFolderName).assignDisplayExtension(displayExtension + " sympa")
      .assignDescription("Folder email lists for working group.  " + gsh_input_workingGroupDescription).save();
  
    // Create admins group
    Group ownersGroup = new GroupSave().assignName(sympaFolderName + ":owners")
      .assignDisplayExtension(displayExtension + " sympa owners")
      .assignDescription("Owners list manages the email list for the working group.  " + gsh_input_workingGroupDescription).save();
  
    // Create subscribers group
    Group subscribersGroup = new GroupSave().assignName(sympaFolderName + ":subscribers").assignDisplayExtension(displayExtension + " sympa subscribers")
      .assignDescription("Subscribers list receives working group emails.  " + gsh_input_workingGroupDescription).save();
  
    // Add admin group to owners group
    new MembershipSave().assignGroup(ownersGroup).assignSubject(adminsGroup.toSubject()).save();


Tasks

These are tasks in order of priority

Document means

  • Make a wiki doc like this 
    • Grouper version
    • legacy calls at bottom
    • each method described
  • Remove from existing doc
Task or GSH operationImplementDocumentTestedTO DOReplace all settings?Developer
GrouperSessionDoneDoneDone
NChris
GroupFinderDoneDoneDoneAllow null GrouperSession (if null just get from static)NVivek
StemFinderDoneDoneDoneAllow null GrouperSession (if null just get from static)N
StemSaveDoneDoneDone
YVivek
AttributeAssignToStemSaveDoneDoneDoneAdd method to take into account if adding attribute assignment (default to no)Maybe laterVivek
AttributeAssignToGroupSaveDoneDoneDoneAlso move "group type" GSH documentation to this new wiki as legacyMaybe laterVivek
AttributeAssignToAssignmentSaveDoneDoneDone
Maybe laterVivek
AttributeAssignValueSaveDoneDoneDoneManage adding or assigning values to an AttributeAssignmentMaybe laterVivek
AttestationStemSaveDoneDoneDoneWrite tests and documentationYVivek
AttestationGroupSaveDoneDoneDone
YVivek
GrouperPasswordSaveDoneDoneDone
N
AttributeDefSaveDoneDoneDone
YVivek
AttributeDefNameSaveDoneDoneDone
YVivek
PrivilegeGroupInheritanceSaveDoneDoneDone
NVivek
PrivilegeStemInheritanceSaveDoneDoneDone
NVivek
PrivilegeAttributeDefInheritanceSaveDoneDoneDone
NVivek
GdgTypeGroupSaveDoneDoneDoneChange UI to call this (similar to attestation stem save?) DoneMaybe laterVivek
GdgTypeStemSaveDoneDoneDoneChange UI to call this (similar to attestation stem save?) DoneMaybe laterVivek
GdgTypeGroupFinderDoneDoneDoneChange UI to call this DoneNVivek
GdgTypeStemFinderDoneDoneDoneChange UI to call this DoneNVivek
CompositeSaveDoneDoneTODO
N
CompositeFinderDoneDoneTODOadd a way to find one specific compositeN
MembershipSaveDoneDoneTODO
Maybe later
MembershipFinderDoneDoneTODO
N
MemberFinderDoneDoneTODO
N
SubjectFinderDoneDoneTODO
N
StemCopyDoneDoneTODO
N
GroupCopyDoneDoneTODO
N
GrouperEmailDoneDoneDone
NChris
GcDbAccessDoneDoneDoneArbitrary SQL calls with bind varsN
LdapSessionUtilsDoneDoneDoneArbitrary LDAP callsN
ProvisionableStemSaveDoneDoneDoneAlso use this from UI?  Coordinate with Shilen?Maybe laterVivek
ProvisionableGroupSaveDoneDoneDoneAlso use this from UI?  Coordinate with Shilen?Maybe laterVivek
ProvisionableStemFinderDoneDoneDoneAlso use this from UI?  Coordinate with Shilen?Maybe laterVivek
ProvisionableGroupFinderDoneDoneDoneAlso use this from UI?  Coordinate with Shilen?Maybe laterVivek
GshTemplateExecDoneDoneDoneAdd easier ways to add input values (without needing to instantiate GshTemplateInput object?)N
Create script from SQLNATODONAJust move docs from GSH page to new pageN
MessagingNATODONAJust move docs from GSH page to new page(s)N
JEXL testingNATODONAJust move docs from GSH page to new pageN
RegistryNATODONAJust move docs from GSH page to new pageN
Grouper config filesDoneTODODoneHow to read properties from various property files, various data typesN
GrouperHttpClientDoneDoneNA
NAChris
Longer term
PrivilegeGroupFinderTODOTODOTODO


PrivilegeAttributeDefFinderTODOTODOTODO


PrivilegeStemFinderTODOTODOTODO


AttributeAssignToEffectiveMembershipSaveTODOTODOTODO


AttributeAssignToImmediateMembershipSaveTODOTODOTODO


AttributeAssignToMemberSaveTODOTODOTODO


MemberChangeSubjectSaveTODOTODOTODO


PrivilegeGroupInheritanceFinderTODOTODOTODO


PrivilegeStemInheritanceFinderTODOTODOTODO


PrivilegeAttributeDefInheritanceFinderTODOTODOTODO


ConfigInDbSaveTODOTODOTODOSee GrouperEmail.addAllowEmailToGroup()

GroupSaveDoneDoneDoneAdd replaceAllSettings like AttestationStemSave

StemSaveNANANAAdd replaceAllSettings like AttestationStemSave

AttestationGroupSaveNANANAChange UI logic so it calls the new logic

AttestationStemSaveNANANAChange UI logic so it calls the new logic

AttributeDefSaveNANANAAdd replaceAllSettings like AttestationStemSave

PrivilegeGroupInheritanceSaveNANANAChange UI logic so it calls the new logic

PrivilegeStemInheritanceSaveNANANAChange UI logic so it calls the new logic

PrivilegeAttributeDefInheritanceSaveNANANAChange UI logic so it calls the new logic

Interacting with daemon jobs?NANA


USDUTODOTODOTODOSee what we can do for builder classes here

Import / export?TODOTODO


Transactions?TODOTODODecide on recommended strategy and document

  • No labels