Grouper rules are configurable declarative scripts which run at certain times and perform actions on the registry.  They are similar to hooks though you dont have to write Java, and it does not require a change to a config file to enable a rule (i.e. anyone with authority in the folder hierarchy could enable a rule).

Use cases

Composite-ng: If an entity is no longer a member of the employee group, remove them from the group for application X

Disabled-date activation: If a student is no longer a member of the course X group, then add a membership to the course wiki group with end date in one week (note, this assumes that if the student is out of the course group, they fall out of the wiki group, another variation is to set an end date on an existing membership)

Composite-org: If an entity falls out of any group in the IT organization groups (meaning not a central IT employee anymore), then remove them from group X

Inherited permissions: If a group is created under folder a:b, then apply privileges to the group of READ,UPDATE to group a:security:admins

Rule structure

The rule structure is custom for Grouper since we want it to be performant and secure, however it is inspired from drools.  There are several parts to a rule:

Rule data

The rule will be an attribute of a grouper object (group, stem, etc).  It will be specified as JSON.  We can have a screen on the UI which helps create the JSON, or we could split this up into multiple attributes if we like.  e.g. the following rule could be an attribute on group: b:c:d, who's name would get the variable "thisGroupName"

 {
  "RuleDefinition":{
    "actAs":{
      "sourceId":"kerberosPrincipals",
      "subjectId":"myApp/myServer.school.edu"
    },
    "check":{
      "group":"a:b:c",
      "type":"flattenedMembershipRemove"
    },
    "ifCondition":"",
    "then":"${RulesUtils.removeMember(thisGroupName, subjectSourceId, subjectId}"
  }
}

sadf

Daemon component

If the rule is not scripted, then we have the opportunity to run it in daemon mode at the time the rule was added or changed, or periodically (nightly/weekly) to reduce data corruptions.  Some rules might not want this to happen (e.g. on group create set permissions, if you do this nightly then you cant remove permissions)

Error handling

If the rule execution fails for some reason, it should be logged (which could include emailing administrators), but it probably should not affect the transaction of the operation that triggered the rule.  Maybe this can be a setting on a per rule basis and where applicable (e.g. if it is a flattened membership rule trigger, then there is no transaction since the rule fires post commit anyways.