|
| 1 | +--- |
| 2 | +title: "MemberOf Plugin Specific Group Scoping" |
| 3 | +--- |
| 4 | + |
| 5 | +# MemberOf Plugin Specific Group Scoping |
| 6 | +---------------- |
| 7 | + |
| 8 | +Overview |
| 9 | +-------- |
| 10 | + |
| 11 | +While you can include/exclude subtrees/containers that the memberOf plugin should process there is currently no way to specify individual groups to include or exclude. This feature allows Administrators to control if specific groups should be included or excluded from the MemberOf plugin updates. |
| 12 | + |
| 13 | +Use Cases |
| 14 | +--------- |
| 15 | + |
| 16 | +Admins may only need select groups to be maintained by the memberOf plugin. Or, they may have certain groups that do not need the memberOf plugin updates. Limiting the scope of the memberOf plugin can improve performance and reduce the overhead of group updates. |
| 17 | + |
| 18 | +Design |
| 19 | +------ |
| 20 | + |
| 21 | +There is already a "scoping" function in the code: **memberof_entry_in_scope** This function is used to check any entry involved with the group update - meaning both groups and members. Members can be "users" or non-groups, and they can also be other/nested groups. Previously this function just checked if there was included/excluded subtrees. Now we will also check for "specific groups". |
| 22 | + |
| 23 | +This presents a challenge when trying to scope specific "groups" and not scope "non-group" members. For example, **memberof_entry_in_scope** is also used when processing new "members". So it needs to know if the member is a group or not. If it is a group, then we need to check the include/exclude specific group constraints, otherwise we can just proceed with updating that member. |
| 24 | + |
| 25 | +To overcome this issue we must determine if an entry is a "group" or not. This entry identification is done early in each postop function using the **memberof_set_entry_info** function where we check if the entry has certain "group" objectclasses. If it has one of these objectclasses then we mark the entry as a group. This list of group-defining objectclasses defaults to: *groupOfNames*, *groupOfUniqueNames*, and *nsAdminGroup* (this list of objectclasses can also be customized). So by identifying the entry type as a group or non-group, **memberof_entry_in_scope** can correctly apply the scoping rules. |
| 26 | + |
| 27 | +This is implemented by passing a new *entry_info C struct*, that contains the group DN and its entry type, to **memberof_entry_in_scope**. Now this scoping function knows whether it needs to apply "specific group" scoping or not. Note that we only need this entry-type distinction for handling individual membership updates. The original target entry passed to the plugin is always assumed to be a group (scoping always applies regardless of its objectclasses). |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +Behavior |
| 32 | +-------- |
| 33 | + |
| 34 | +The specific group constraints are strict. If you specify one specific group to include, then all other groups in the DIT will be excluded, regardless of their location. If it's not a "specific group", then it's not updated. Similarly for excluding specific groups, if the group is not in the exclude list, then it gets updated. It doesn't make sense to both include and exclude specific groups simultaneously. Instead, choose one approach that best fits your needs. Using "exclude" rules is the preferred approach as it requires less maintenance, but the choice depends on your specific database usage. |
| 35 | + |
| 36 | +Major configuration options and enablement |
| 37 | +------------------------------------------ |
| 38 | + |
| 39 | +The "entry_info" struct in memberof.c |
| 40 | + |
| 41 | + typedef struct _MemberofEntryInfo |
| 42 | + { |
| 43 | + Slapi_DN *sdn; |
| 44 | + bool group; |
| 45 | + } MemberofEntryInfo; |
| 46 | + |
| 47 | +There are three new multi-valued configuration attributes that can be set in: **cn=MemberOf Plugin,cn=plugins,cn=config**: |
| 48 | + |
| 49 | + - memberOfSpecificGroup: <group DN> |
| 50 | + - memberOfsExcludeSpecificGroup: <group DN> |
| 51 | + - memberOfSpecificGroupOC: <objectclass name> |
| 52 | + |
| 53 | +For example |
| 54 | + |
| 55 | + dn: cn=MemberOf Plugin,cn=plugins,cn=config |
| 56 | + ... |
| 57 | + ... |
| 58 | + memberOfSpecificGroup: cn=test_group1,ou=groups,dc=example,dc=com |
| 59 | + memberOfSpecificGroup: cn=test_group2,ou=groups,dc=example,dc=com |
| 60 | + memberOfExcludeSpecificGroup: cn=large_group,ou=groups,dc=example,dc=com |
| 61 | + memberOfExcludeSpecificGroup: cn=ignore_group,ou=groups,dc=example,dc=com |
| 62 | + memberOfSpecificGroupOC: groupOfUniquenames |
| 63 | + memberOfSpecificGroupOC: groupOfNames |
| 64 | + memberOfSpecificGroupOC: customGroupObjClass |
| 65 | + |
| 66 | + NOTE: You would not want to use both scopes at the same time: memberOfSpecificGroup & memberOfExcludeSpecificGroup. They are only listed as an example of its usage |
| 67 | + |
| 68 | +Origin |
| 69 | +------------- |
| 70 | + |
| 71 | +<https://github.com/389ds/389-ds-base/issues/7035> |
| 72 | + |
| 73 | +Author |
| 74 | +------ |
| 75 | + |
| 76 | +<mreynolds@redhat.com> |
| 77 | + |
0 commit comments