-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Conversation
…cts that require access, instead of their groups
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) |
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.
This feels wrong. Let's add require_access_to_groups
that takes groups?
Btw, object
is a reserved word.
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.
Btw, object is a reserved word.
You sure? I would expect things to not work if it were a reserved keyword.
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.
>>> object
<type 'object'>
Python is funny in this way. id
is reserved too and often we override it locally.
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 guess that reserved word is not the correct term here. Just a built-in object.
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.
Yeah, while not reserved, it might cause confusion. I'll rename.
53269ce
to
1f16998
Compare
* 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
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)
Description
Related Tickets & Documents
#3495
Mobile & Desktop Screenshots/Recordings (if there are UI changes)