You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by "ozimakov (via GitHub)" <gi...@apache.org> on 2026/04/19 02:36:37 UTC
[PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
ozimakov opened a new pull request, #1352:
URL: https://github.com/apache/syncope/pull/1352
### Problem
For notifications bound to `[LOGIC]:[UserLogic]:[]:[delete]:[SUCCESS]`, templates that reference the subject user (e.g. `${user.getPlainAttr("u_email").get().values[0]}`) were evaluated with an empty user: after delete, `userDAO.findById` no longer returns the entity, so the JEXL context never received a user variable. The before snapshot from `LogicInvocationHandler` already held a full `UserTO`, but it was not used when the persisted entity was gone.
### Solution
In `DefaultNotificationManager.createTasks`, when no Any can be loaded from the persistence layer but before is a `UserTO`, `GroupTO`, or `AnyObjectTO`, populate the corresponding JEXL variables (user, group, anyObject) from that snapshot so mail templates keep working for delete success events.
### Changes
`DefaultNotificationManager.java`: fallback to before transfer objects when any is empty.
`DefaultNotificationManagerTest.java`: unit test with `userDAO.findById` empty and a template using plain attributes (same JEXL style as existing mail template tests).
### Testing
```
mvn -pl core/provisioning-java -Dtest=DefaultNotificationManagerTest test
mvn -pl core/provisioning-java checkstyle:check
mvn clean test -pl core/provisioning-java -am
mvn test (full reactor)
```
### References
https://issues.apache.org/jira/browse/SYNCOPE-1744
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on PR #1352:
URL: https://github.com/apache/syncope/pull/1352#issuecomment-4286919502
Thank you @ozimakov !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on code in PR #1352:
URL: https://github.com/apache/syncope/pull/1352#discussion_r3108699795
##########
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/DefaultNotificationManager.java:
##########
@@ -355,6 +355,15 @@ public List<NotificationTask> createTasks(
}
}
});
+ if (any.isEmpty()) {
Review Comment:
Why not moving these statements above, e.g. change lines 346 and below from
```java
any.ifPresent(a -> {
...
});
```
to
```java
any.ifPresentOrElse(
a -> {
switch (a) {
case User user ->
jexlVars.put("user", userDataBinder.getUserTO(user, true));
case Group group ->
jexlVars.put("group", groupDataBinder.getGroupTO(group, true));
case AnyObject anyObject ->
jexlVars.put("anyObject", anyObjectDataBinder.getAnyObjectTO(anyObject, true));
default -> {
}
}
},
() -> {
switch (before) {
case UserTO userTO ->
jexlVars.put("user", userTO);
case GroupTO groupTO ->
jexlVars.put("group", groupTO);
case AnyObjectTO anyObjectTO ->
jexlVars.put("anyObject", anyObjectTO);
default -> {
}
}
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ozimakov (via GitHub)" <gi...@apache.org>.
ozimakov commented on PR #1352:
URL: https://github.com/apache/syncope/pull/1352#issuecomment-4276674707
> Hi @ozimakov thanks for this PR. If you haven't done this before, please go ahead and submit [your ICLA](https://www.apache.org/licenses/contributor-agreements.html#clas) to the ASF, thank you.
Thanks for the heads-up and for your continued work. I've submitted the documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso merged PR #1352:
URL: https://github.com/apache/syncope/pull/1352
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on PR #1352:
URL: https://github.com/apache/syncope/pull/1352#issuecomment-4275244986
Hi @ozimakov thanks for this PR.
If you haven't done this before, please go ahead and submit [your ICLA](https://www.apache.org/licenses/contributor-agreements.html#clas) to the ASF, thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on PR #1352:
URL: https://github.com/apache/syncope/pull/1352#issuecomment-4287100270
FYI I have cherry-picked your commit to fix the issue on branches `4_1_X` and `4_0_X` as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on code in PR #1352:
URL: https://github.com/apache/syncope/pull/1352#discussion_r3108699795
##########
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/DefaultNotificationManager.java:
##########
@@ -355,6 +355,15 @@ public List<NotificationTask> createTasks(
}
}
});
+ if (any.isEmpty()) {
Review Comment:
Why not moving these statements above, e.g. change lines 346 and below from
```java
any.ifPresent(a -> {
...
```
to
```java
any.ifPresentOrElse(
a -> {
switch (a) {
case User user ->
jexlVars.put("user", userDataBinder.getUserTO(user, true));
case Group group ->
jexlVars.put("group", groupDataBinder.getGroupTO(group, true));
case AnyObject anyObject ->
jexlVars.put("anyObject", anyObjectDataBinder.getAnyObjectTO(anyObject, true));
default -> {
}
}
},
() -> {
switch (before) {
case UserTO userTO ->
jexlVars.put("user", userTO);
case GroupTO groupTO ->
jexlVars.put("group", groupTO);
case AnyObjectTO anyObjectTO ->
jexlVars.put("anyObject", anyObjectTO);
default -> {
}
}
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] SYNCOPE-1744: restore notification template context after user delete [syncope]
Posted by "ozimakov (via GitHub)" <gi...@apache.org>.
ozimakov commented on code in PR #1352:
URL: https://github.com/apache/syncope/pull/1352#discussion_r3113113129
##########
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/DefaultNotificationManager.java:
##########
@@ -355,6 +355,15 @@ public List<NotificationTask> createTasks(
}
}
});
+ if (any.isEmpty()) {
Review Comment:
done with additional null check, just in case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org