-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Create decorator to check service permissions #22667
Conversation
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.
Looks good! I think we need a test. But let's hear what core thinks first.
Haven't looked at too details, several thought:
|
b2e35e0
to
a1acda5
Compare
Codecov Report
@@ Coverage Diff @@
## dev #22667 +/- ##
==========================================
+ Coverage 94.13% 94.14% +<.01%
==========================================
Files 448 448
Lines 36720 36741 +21
==========================================
+ Hits 34567 34589 +22
+ Misses 2153 2152 -1
Continue to review full report at Codecov.
|
1905b05
to
0de9785
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.
Ok to merge when final comment addressed
Co-Authored-By: bachya <bachya1208@gmail.com>
Description:
Following up on @MartinHjelmare's and @balloob's suggestion, this PR creates a generic decorator to check user permissions on a service call belonging to a specific domain. The decorator checks the user's permissions against all entities owned by the passed-in domain.
Since this logic originally existed in the RainMachine component, this PR also replaces that logic with this decorator.
Related issue (if applicable): N/A
Pull request in home-assistant.io with documentation (if applicable): N/A
Example entry for
configuration.yaml
(if applicable):N/A
Checklist:
tox
. Your PR cannot be merged unless tests pass