-
Notifications
You must be signed in to change notification settings - Fork 13.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
Programatically sync the role with user list. #1619
Conversation
@@ -348,6 +348,50 @@ def test_request_access(self): | |||
gamma_user.roles.remove(sm.find_role('dummy_role')) | |||
session.commit() | |||
|
|||
def test_update_role(self): |
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.
is it typical in python to have one test that asserts multiple things? would it make sense to break this into multiple tests?
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.
+1 on breaking tests down, refactoring shared parts out to methods
@has_access | ||
@expose("/update_role/", methods=['POST']) | ||
def update_role(self): | ||
"""Assigns a list of found users to the give role.""" |
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.
s/give/given
for user_email in user_emails: | ||
user = sm.find_user(email=user_email) | ||
if not user: | ||
continue |
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.
if user:
role.user.append(user)
return json_error_response( | ||
__("%(role)s role was not found", role=role_name)) | ||
role.user = [] | ||
for user_email in user_emails: |
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.
for user_email in data['user_emails']
remove the need for 1082
@@ -1073,6 +1073,27 @@ def msg(self): | |||
|
|||
class Superset(BaseSupersetView): | |||
"""The base views for Superset!""" | |||
|
|||
@has_access |
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.
has_access_api
LGTM once the build is fixed. |
all done, thanks for the review @mistercrunch and @ascott ! |
Reviewers: