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

Change has_access and require_access signatures #3611

Merged
merged 4 commits into from
Mar 28, 2019

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Mar 20, 2019

This was actually part of #3495, but it's spread across many files and is a simple refactor so I just wanted to take it out to it's own PR in order to clean up #3495.

What type of PR is this? (check all applicable)

  • Refactor

Description

Related Tickets & Documents

#3495

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

…cts that require access, instead of their groups
@rauchy rauchy requested a review from arikfr March 20, 2019 08:04
@ghost ghost assigned rauchy Mar 20, 2019
@ghost ghost added the in progress label Mar 20, 2019
redash/permissions.py Outdated Show resolved Hide resolved
require_access(dict(groups), user, view_only)
object = lambda: None
object.groups = dict(groups)
require_access(object, user, view_only)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels wrong. Let's add require_access_to_groups that takes groups?

Btw, object is a reserved word.

Copy link
Contributor Author

@rauchy rauchy Mar 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, object is a reserved word.

You sure? I would expect things to not work if it were a reserved keyword.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> object
<type 'object'>

Python is funny in this way. id is reserved too and often we override it locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that reserved word is not the correct term here. Just a built-in object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, while not reserved, it might cause confusion. I'll rename.

@rauchy rauchy force-pushed the change-has-access-signature branch from 53269ce to 1f16998 Compare March 27, 2019 07:10
@arikfr arikfr merged commit ec4f77c into master Mar 28, 2019
@arikfr arikfr deleted the change-has-access-signature branch March 28, 2019 13:01
@arikfr
Copy link
Member

arikfr commented Mar 28, 2019

:shipit:

harveyrendell pushed a commit to pushpay/redash that referenced this pull request Nov 14, 2019
* change has_access and require_access signatures to work with the objects that require access, instead of their groups

* rename `object` to `obj`

* support both objects and group dicts in `has_access` and `require_access`

* simplify permission tests once `has_access` accepts groups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants