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
add didUpdateRolePermissions event #8333
Conversation
78c40f9
to
23ed86e
Compare
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.
LGTM, waiting for the tests
I will review it before it is merged |
Codecov Report
@@ Coverage Diff @@
## master #8333 +/- ##
==========================================
+ Coverage 33.19% 33.27% +0.07%
==========================================
Files 1220 1220
Lines 13618 13625 +7
Branches 1357 1357
==========================================
+ Hits 4521 4534 +13
+ Misses 8212 8207 -5
+ Partials 885 884 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
23ed86e
to
a510ce0
Compare
7231017
to
a1dc225
Compare
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.
It would be simpler to send the event from the service as it is where the decision can be made without leaking internal state. to the caller (controller in this case).
Another approach (I like it but I think it's to soon) is to use the eventHub to send a didAssignPermission
like event and have a listener that will check the event and send telemetry if necessary
It was in the service at the begining but @Convly pointed some problems with that : #8333 (comment) |
We can check that the existingPermissions count is > 0 to send the event I believe |
We would miss the edge case where a role has, at some point, 0 permissions and is then updated with some. |
Signed-off-by: Pierre Noël <petersg83@gmail.com>
a1dc225
to
afa67ad
Compare
I think the best place would still have been in the controller. As it is a service, anyone can use it in a plugin or else. So the logic way for this telemetry would be, for me, only with the route which the admin panel calls. |
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'm going to be picky here but I think this need a refactoring.
We should have the assignPermissions and addPermissions methods in the role service and those could use the permissions service for createMany (which would not have a role there) Let's decouple those two services
5f9b6c8
to
8436cb1
Compare
8436cb1
to
907d6c9
Compare
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.
last comment :)
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
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.
LGTM
No description provided.