Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Page
spaceKeyGrouper
pageTitleNavigation

Grouper UI templates are available in Grouper 2.4 will have an upcoming patch to help folder admins create a new template.  +.

The UI templates allow folder admins to run a function.  The template creates folders and groups and assigns privileges based on inputs.  This will allow Grouper users to accomplish multiple tasks at once and save time and be more consistent.   The original template implementation was Java-based.  In 2.5+ templates can be implemented with configuration and GSH scripts (Java/groovy).

Tip

Using the template wizard provides a convenient approach to implementing the recommendations for folder and group structure from the Grouper Deployment Guide.


Children Display

Table of Contents

Using the Template Wizard

On a folder screen, under "more actions" will be an option for "New Run template"


Image Added

The wizard will prompt for "Template type", which by default "Service".has "Application" and "Grouper Deployment Guide structure."

Image Added

Application built-in template

The "application" option allows you to give a friendly name to an application and prompts you to set up the recommended folders for an application to be integrated with Grouper.

Image Added

...


Image Added


Grouper Deployment Guide structure built-in template

This is a convenient way to implement the recommendations for folder structure from the Grouper Deployment Guide

Image Added


...


Image Added

Creating your own template (GSH)

See the GSH templates for examples

Creating your own template (legacy)

New New service templates should be configured in grouper-ui.properties, and should extend a common base class.  GrouperTemplateLogicBase

  • Base class
  • In Java will configure options for new service

...

See the built-ins for examples

Code Block
#######################################
############## New service template
#######################################

## use capturing group from regex as the key in the dropdown. eg: service for the below string
grouper.template.service.logicClass=edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperNewServiceTemplateLogic

grouper.template.tierStructure.logicClass=edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperTierStructureLogic


The wizard will prompt them for a "key" (alphanumeric), and friendly name (optional).  Also the service description.

...

  • reference back to service (which has reference to stem name, and system and display extensions)
  • indentLevel (if should be indented on screen to make easier to read, e.g. under a new stem)
  • type: stem, group, membership, privilege, inheritedPrivilege, attributeDef, attributeName, attributeAssignment
  • arg0: e.g. for stem would be EL for the name, e.g. ${parentStemName}:${serviceSystemName}:etc.  e.g. for privilege is the privilegeName
  • arg1
  • arg2
  • externalized key for the label
  • defaultChecked (true|false)
  • checkSubmitted (if the checkbox was checked by user)

The UI should display the ServiceActions on the screen, with the correct indent level, and checkboxes

When submitted, if each checkbox is checked, it should do that action (if applicable).  If not applicable, give a warning

By default have one new service type built-in to Grouper

"New service"

Name: wiki

Display name: Wiki

  • Do you want a "etc" folder created?
    • Do you want a "etc:wiki_admins" group created?
      • Do you want "etc:wiki_admins" to have inherited ADMIN privileges on Groups on the "wiki" folder?
      • Do you want "etc:wiki_admins" to have inherited ADMIN privileges on Folders on the "wiki" folder?
      • Do you want "etc:wiki_admins" to have inherited ADMIN privileges on Attributes on the "wiki" folder?
    • Do you want a "etc:wiki_readers" group created?
      • Do you want "etc:wiki_readers" to have inherited READ privileges on Groups on the "wiki" folder?
    • Do you want a "etc:wiki_updaters" group created?
      • Do you want "etc:wiki_updaters" to have inherited UPDATE privileges on Groups on the "wiki" folder?
      • Do you want "etc:wiki_updaters" to be a member of "etc:wiki_readers"?
  • Do you want a "groups" folder created?
  • Do you want a "team" folder created?
  • Do you want a "attribute" folder created?

To do in future

.  The UI will pass the list of pojos, and "checkSubmitted" is set based on if the checkboxes were checked, to the base class, for a logic method, to implement the template.  There should be a base class method to validate the input, pass the response JS object, and the validate method can write error messages to the screen and return true or false if valid.

Run GSH template from GSH

See the GSH attribute sync example

Run template from GSH (legacy)

Note: GSH must be run from the UI.  This works in v4.1.5+

Code Block
    String templateType = "service";
    String stemName = "test";
    String templateKey = "app3";
    String serviceDescription = "app3 app";
    String serviceFriendlyName = "app3";
    boolean createSubFolder = true;
    GrouperSession grouperSession = GrouperSession.startRootSession();
    Stem stem = StemFinder.findByName(grouperSession, stemName, true);
    edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperRequestContainer.assignUseStaticRequestContainer(true);
    edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperRequestContainer grouperRequestContainer = edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperRequestContainer.retrieveFromRequestOrCreate();
    edu.internet2.middleware.grouper.grouperUi.beans.ui.GroupStemTemplateContainer groupStemTemplateContainer = grouperRequestContainer.getGroupStemTemplateContainer();
    edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperTemplateLogicBase templateLogic = edu.internet2.middleware.grouper.grouperUi.serviceLogic.UiV2Template.getTemplateLogic(templateType, groupStemTemplateContainer);
    templateLogic.setStemId(stem.getUuid());
    groupStemTemplateContainer.setCreateNoSubfolder(!createSubFolder);
    groupStemTemplateContainer.setTemplateKey(templateKey);
    groupStemTemplateContainer.setTemplateDescription(serviceDescription);
    groupStemTemplateContainer.setTemplateFriendlyName(serviceFriendlyName);
    List<edu.internet2.middleware.grouper.grouperUi.beans.ui.ServiceAction> allServiceActions = templateLogic.getServiceActions();
    // if (templateLogic.validate(allServiceActions)) { throw new RuntimeException("Not valid"); } // dont include this line for some reason
    for (edu.internet2.middleware.grouper.grouperUi.beans.ui.ServiceAction serviceAction: allServiceActions) { serviceAction.getServiceActionType().createTemplateItem(serviceAction); }
  

...