LDAP Listener which runs as system user is not able to update a sys_user_group record which contains a scope protected role


After scope protected roles are added to groups (e.g when customers install the "Customer Service Management" plugin and assign any of the CSM roles to a group), the LDAP Listener will not longer be able to update the [sys_user_group] or its members

Steps to Reproduce

Please note this apply to all scoped protected applications. 

1. Install CSM plugin on Madrid/New York instance
2. Assign a OOB CSM role to a group (ie. sn_customerservice_agent to an existing group) that syncronises over LDAP.
3. Run "Refresh from LDAP" or initiate an LDAP Import for the group.
4. You may see "Error occured during row update" or no updates to the record or an error like this in the node logs:

2020-09-17 12:29:16 (644) LDAP Transformfec866b1db67e340f236cf831596190c SYSTEM txid=13caaab1dbdf WARNING *** WARNING *** RoleAccessHandler: User system does not have the role 'sn_templated_snip.template_snippet_reader' which is required to grant/remove 'sn_templated_snip.template_snippet_reader' under application administration, Resource: 'record/sys_user_group/write'


Please ensure to find the specific groups that has a scoped protected role associated to them. 

As the listener runs as system, it will not be able to update the groups while they have the role associated. Ensure your administrators are aware of that. Also, please validate there is a scheduled job setup with a user that have the scoped protected roles needed and the scheduled job will execute regularly.

Related Problem: PRB1383229