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

Programatically sync the role with user list. #1619

Merged
merged 1 commit into from
Nov 21, 2016
Merged

Programatically sync the role with user list. #1619

merged 1 commit into from
Nov 21, 2016

Conversation

bkyryliuk
Copy link
Member

@bkyryliuk bkyryliuk commented Nov 17, 2016

@bkyryliuk bkyryliuk changed the title WIP. Programatically sync the role with user list. Programatically sync the role with user list. Nov 17, 2016
@@ -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):
Copy link
Contributor

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?

Copy link
Member

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."""
Copy link
Contributor

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
Copy link
Member

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:
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

has_access_api

@mistercrunch
Copy link
Member

LGTM once the build is fixed.

@bkyryliuk
Copy link
Member Author

all done, thanks for the review @mistercrunch and @ascott !

@bkyryliuk bkyryliuk merged commit c90dd49 into apache:master Nov 21, 2016
@bkyryliuk bkyryliuk deleted the add_users_to_roles branch November 21, 2016 18:06
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.14.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants