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

Add permission checking to all RainMachine services #22399

Merged
merged 7 commits into from Apr 1, 2019

Conversation

@bachya
Copy link
Contributor

commented Mar 25, 2019

Description:

This PR implements user permission checking on all RainMachine services (per the "Can I Have User Permissions?" blog post).

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):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

@bachya bachya self-assigned this Mar 25, 2019

@ghost ghost added the in progress label Mar 25, 2019

@bachya bachya force-pushed the bachya:rainmachine-service-permissions branch from b4ee99b to 390cac3 Mar 26, 2019

@bachya

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2019

@balloob, I still need to write a test, but in the meantime, could you check b97c594 and comment on whether I'm on the correct track?

bachya added some commits Mar 25, 2019

@bachya bachya force-pushed the bachya:rainmachine-service-permissions branch from b97c594 to e8c0fe2 Mar 31, 2019

bachya and others added some commits Mar 31, 2019

@ghost ghost assigned balloob Apr 1, 2019

@balloob

balloob approved these changes Apr 1, 2019

@balloob balloob merged commit 3d8efd4 into home-assistant:dev Apr 1, 2019

5 of 11 checks passed

ci/circleci: pre-install-all-requirements CircleCI is running your tests
Details
ci/circleci: pre-test 3.5.5 CircleCI is running your tests
Details
ci/circleci: static-check CircleCI is running your tests
Details
ci/circleci: test 3.6 Your tests are queued behind your running builds
Details
ci/circleci: test 3.7 Your tests are queued behind your running builds
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Hound No violations found. Woof!
build Workflow: build
Details
ci/circleci: pre-test 3.6 Your tests passed on CircleCI!
Details
ci/circleci: pre-test 3.7 Your tests passed on CircleCI!
Details
cla-bot Everyone involved has signed the CLA

@ghost ghost removed the in progress label Apr 1, 2019

@@ -128,6 +131,44 @@
}, extra=vol.ALLOW_EXTRA)


def _check_valid_user(hass):

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Apr 1, 2019

Member

Shouldn't we make this a helper decorator? There's nothing here that is specific to rainmachine. It could be used on any domain that has entity registry support that needs to do the same check, if we pass in domain.

This comment has been minimized.

Copy link
@bachya

bachya Apr 1, 2019

Author Contributor

Yes, love that idea. I'll submit a PR.

This comment has been minimized.

Copy link
@balloob

balloob Apr 1, 2019

Member

@bachya and then maybe also update your implementation here so that you do something like this:

check_valid_user = GEN_FUNC(hass, DOMAIN)

@check_valid_user
async def handle_bla(call):

That way the decorator is re-used instead of re-generated each time.

@bachya bachya deleted the bachya:rainmachine-service-permissions branch Apr 1, 2019

@bachya bachya referenced this pull request Apr 2, 2019

Merged

Create decorator to check service permissions #22667

3 of 3 tasks complete

unibeck pushed a commit to unibeck/home-assistant that referenced this pull request Apr 7, 2019

Add permission checking to all RainMachine services (home-assistant#2…
…2399)

* Add permission checking to all RainMachine services

* Linting

* Some initial work

* Owner comments

* Test in place (I think)

* Linting

* Update conftest.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.