...
Assign this rule to the folder that has groups where membership is added.
Configure rule for v5+
Configure rule for v4 and previous
Java example
Code Block |
---|
//add a rule on stem:a saying if you are added to a group in the stem by a new paths (flattened), then send an email AttributeAssign attributeAssign = ruleStem .getAttributeDelegate().addAttribute(RuleUtils.ruleAttributeDefName()).getAttributeAssign(); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleActAsSubjectSourceIdName(),actAsSubject.getSourceId()); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleActAsSubjectIdName(), actAsSubject.getId()); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleCheckTypeName(), RuleCheckType.flattenedMembershipAddInFolder.name()); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleCheckStemScopeName(), Stem.Scope.SUB.name()); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleThenEnumName(), RuleThenEnum.sendEmail.name()); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleThenEnumArg0Name(), emailToValue); //the to, subject, or body could be text with EL variables, or could be a template. If template, it is //read from the classpath from package: grouperRulesEmailTemplates/theTemplateName.txt //or you could configure grouper.properties to keep them in an external folder, not in the classpath attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleThenEnumArg1Name(), emailSubjectValue); attributeAssign.getAttributeValueDelegate().assignValue( RuleUtils.ruleThenEnumArg2Name(), emailBodyValue); //should be valid String isValidString = attributeAssign.getAttributeValueDelegate().retrieveValueString( RuleUtils.ruleValidName()); if (\!StringUtils.equals("T", isValidString)) { throw new RuntimeException(isValidString); } |
...