Skip to content

Change has_access and require_access signatures#3611

Merged
arikfr merged 4 commits into
masterfrom
change-has-access-signature
Mar 28, 2019
Merged

Change has_access and require_access signatures#3611
arikfr merged 4 commits into
masterfrom
change-has-access-signature

Conversation

@rauchy

@rauchy rauchy commented Mar 20, 2019

Copy link
Copy Markdown
Contributor

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
Comment thread redash/permissions.py Outdated
Comment thread redash/handlers/queries.py Outdated
require_access(dict(groups), user, view_only)
object = lambda: None
object.groups = dict(groups)
require_access(object, user, view_only)

Copy link
Copy Markdown
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.

@rauchy rauchy Mar 27, 2019

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

arikfr commented Mar 28, 2019

Copy link
Copy Markdown
Member

: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