-
Notifications
You must be signed in to change notification settings - Fork 546
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
Improve action management service to manage actions with rules. #6269
Conversation
These issues are not quite valid |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6269 +/- ##
============================================
+ Coverage 45.25% 45.71% +0.45%
- Complexity 14339 14363 +24
============================================
Files 1633 1655 +22
Lines 104178 103542 -636
Branches 18740 18165 -575
============================================
+ Hits 47145 47331 +186
+ Misses 50181 49367 -814
+ Partials 6852 6844 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
PR builder started |
PR builder completed |
components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml
Show resolved
Hide resolved
...main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOFacade.java
Show resolved
Hide resolved
...main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOFacade.java
Outdated
Show resolved
Hide resolved
...main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOFacade.java
Outdated
Show resolved
Hide resolved
if (existingActionDTO.getActionRule() == null && updatingActionDTOBuilder.getActionRule() != null) { | ||
// This means a new action rule is added when updating the action. | ||
addActionRule(updatingActionDTOBuilder, tenantDomain); | ||
} else if (existingActionDTO.getActionRule() != null && updatingActionDTOBuilder.getActionRule() == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we follow the json patch operation for action update. In that case, attributes can be null in the action update payload.
As we checked the updatingActionDTOBuilder.getActionRule() == null
condition in here, we may need to send the rule object everytime in the update payload, even if it is not updating.
Are there any other options we can use to delete the rule from the action update api ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get you. This doesn't check other attributes. This just check for rule. So, rule doesn't need to be there in payload always
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With current approach for updating action, some respective attributes in the payload can be null when they are not updating(Eg: When only the action name is updating, payload only contains the name; others are null).
Let's say we have a rule configured in the action, and we are updating the action name. In that case, rule will be null in the payload. Due to that, this condition(updatingActionDTOBuilder.getActionRule() == null
) will be true and it will delete the rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so it's not a put and a patch. Then we have to think of a different way. Good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed as below.
- Current patching capability is preserved
- When a rule is not updated as the action updates, the payload should not include the rule object.
- When rule is added or updated, it should send the rule object with it's expressions and other rules
- When rule is removed, the payload should include an empty rule object. e.g.,
rule:{}
...main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOFacade.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java
Show resolved
Hide resolved
...ava/org/wso2/carbon/identity/action/management/internal/ActionMgtServiceComponentHolder.java
Outdated
Show resolved
Hide resolved
...nagement/src/main/java/org/wso2/carbon/identity/action/management/util/ActionDTOBuilder.java
Show resolved
Hide resolved
fa24ffe
to
a2e9b6c
Compare
a2e9b6c
to
0d58c41
Compare
...c/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java
Show resolved
Hide resolved
...main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOFacade.java
Show resolved
Hide resolved
...main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOFacade.java
Show resolved
Hide resolved
dbc0b1d
to
a1a8a19
Compare
Quality Gate passedIssues Measures |
PR builder started |
PR builder started |
PR builder completed |
Failing test case here is actually passing locally |
PR builder started |
PR builder completed |
Merged as the failing test case is passing locally supposing it's an intermittent failure. |
Proposed changes in this pull request
Resolves wso2/product-is#22185
When it comes to extensions it should be possible to let to invoke extensions conditionally based on some rule applicable to the context.
This PR introduce the capability to manage such extensions (actions) with rules improving the action management service component to add/update actions with rules using rule management service.
Note audit logs for rule update in actions will be done in a future iteration: wso2/product-is#22186