Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: instance on demand the azure connection proxy
  • Loading branch information
Angeluz-07 committed Nov 27, 2020
commit e66595158409a435d2f8a05e07415a386c9f4b5f
8 changes: 3 additions & 5 deletions time_tracker_api/users/users_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from utils.azure_users import AzureConnection


azure_connection = AzureConnection()

ns = api.namespace('users', description='Namespace of the API for users')

# User Model
Expand Down Expand Up @@ -59,7 +57,7 @@ class Users(Resource):
@ns.marshal_list_with(user_response_fields)
def get(self):
"""List all users"""
return azure_connection.users()
return AzureConnection().users()


@ns.route('/<string:id>/roles')
Expand All @@ -75,7 +73,7 @@ class UserRoles(Resource):
@ns.marshal_with(user_response_fields)
def post(self, id):
"""Create user's role"""
return azure_connection.update_user_role(id, ns.payload['role'])
return AzureConnection().update_user_role(id, ns.payload['role'])


@ns.route('/<string:user_id>/roles/<string:role_id>')
Expand All @@ -88,4 +86,4 @@ class UserRole(Resource):
@ns.marshal_with(user_response_fields)
def delete(self, user_id, role_id):
"""Delete user's role"""
return azure_connection.update_user_role(user_id, role=None)
return AzureConnection().update_user_role(user_id, role=None)