Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of changed ACTIVITYGROUPS #9

Conversation

emilitzerjo
Copy link

This patch improves the handling of changed activitygroups if the ACTIVITYGROUPS.AGR_NAME field will be used
in the resource configuration.
If you would implement the resource configuration with an association from the user to the activitygroup via the
AGR_NAME field, midpoint will write down the whole attribute again when changing one entry in the list.
Because the AGR_NAME field only stores AGR_NAMEs it has no information on the current from/to dates in the actual activitygroups
field and will simply overwrite everything in the SAP with empty from/to fields. SAP generates the current date as a from date
so if you have a role change on another date every role in the SAP will be deleted and added again. All the information
about the actual date of assignment will be lost. This also generates a lot of audit entries in the SAP.

To avoid this, this patch loads the current state of the user from the SAP and uses the existing data if nothing has
provided by midpoint. To propagate actual changes in the ACTIVITYGROUPS from/to fields the change algorithm will check if
the attributes from the midpoint are xml attributes. If yes it will simply use those values because they have the biggest
accuracy. If not it will use the current data from the SAP for those values.

@emilitzerjo emilitzerjo force-pushed the fix-activitygroups-rewrite-on-update branch 2 times, most recently from 11bfd49 to 537a0de Compare February 21, 2022 10:41
@emilitzerjo
Copy link
Author

I updated the PR to the new merge. This feature can also be implemented for profiles and their BAPIPROF shorcut attribute. I can implement this too if you are interested in it.

@emilitzerjo emilitzerjo marked this pull request as ready for review February 21, 2022 10:44
@emilitzerjo emilitzerjo force-pushed the fix-activitygroups-rewrite-on-update branch from e4ff724 to 537a0de Compare February 21, 2022 10:57
@martin-lizner
Copy link
Collaborator

Hi, personally I recommend handling SAP roles as XML via attribute ri:ACTIVITYGROUPS. You would need special meta role that creates the XML for respective role and derives dates from focusAssignment?.activation field. Using flat list leads to problems you described.

Thank you for your pull request, its a workaround, but probably necessary if you go with the flat list :-) Anyway please make sure that the change does not fiddle with ACTIVITYGROUPS XML behaviour. If only midPoint has support for complex resource attributes, that would make things much easier.

Regards, Martin

@matusmacik
Copy link
Contributor

Imho I would be open to merge this pull request but if possible please make this feature optional via a configurational option in the connector configuration.

@emilitzerjo
Copy link
Author

Thanks for the feedback, i will look into it and come back to you

@emilitzerjo emilitzerjo force-pushed the fix-activitygroups-rewrite-on-update branch 2 times, most recently from 284a2c5 to ed51ad2 Compare December 7, 2023 08:32
This patch improves the handling of changed activitygroups if the ACTIVITYGROUPS.AGR_NAME field will be used
in the resource configuration.
If you would implement the resource configuration with an association from the user to the activitygroup via the
AGR_NAME field, midpoint will write down the whole attribute again when changing one entry in the list.
Because the AGR_NAME field only stores AGR_NAMEs it has no information on the current from/to dates in the actual activitygroups
field and will simply overwrite everything in the SAP with empty from/to fields. SAP generates the current date as a from date
so if you have a role change on another date every role in the SAP will be deleted and added again. All the information
about the actual date of assignment will be lost. This also generates a lot of audit entries in the SAP.

To avoid this, this patch loads the current state of the user from the SAP and uses the existing data if nothing has
provided by midpoint. To propagate actual changes in the ACTIVITYGROUPS from/to fields the change algorithm will check if
the attributes from the midpoint are xml attributes. If yes it will simply use those values because they have the biggest
accuracy. If not it will use the current data from the SAP for those values.
@emilitzerjo emilitzerjo force-pushed the fix-activitygroups-rewrite-on-update branch from ed51ad2 to 5535694 Compare December 7, 2023 08:36
@emilitzerjo
Copy link
Author

I would like to revive this PR. I added the config parameter and some documentation.
@matusmacik @martin-lizner

@martin-lizner martin-lizner merged commit 6a6c283 into Evolveum:master Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants