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

Updates to CapState are emitted in the wrong place #215

Open
adamdama opened this issue Aug 23, 2023 · 0 comments
Open

Updates to CapState are emitted in the wrong place #215

adamdama opened this issue Aug 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@adamdama
Copy link
Contributor

Evaluating the user grants for a given capability is currently performed in the user_grants module evaluate_options function: https://github.com/rdkcentral/Ripple/blob/main/core/main/src/service/user_grants.rs#L890

Once the user has granted or denied the challenge the result needs to be emitted out to listening parties. The emission of this event is currently being done as part of the evaluation process once all challenges have succeeded or at the point of the first error.

This is working in the success case, however when trying to emit the CapEvent::OnRevoked event a success payload is produced. The payload for the event is produced in the [get_cap_info](https://github.com/rdkcentral/Ripple/blob/main/core/main/src/state/cap/cap_state.rs#L201) function in the cap_state module where the currently store grant state is checked. As the grant state has not yet been updated to store the denied challenges the payload produced is a success payload.

This should be addressed by moving the event emission over to the check_with_roles function in the user_grants module. At this point in time the grant state and privacy settings will have been updated appropriately and the correct payload should be produced.

When addressing this issue we need to ensure the correct unit test cases are in place so that we are certain it has been solved and to protect us from regressions.

@adamdama adamdama added the bug Something isn't working label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant