Skip to content

Commit

Permalink
global: remove user management
Browse files Browse the repository at this point in the history
* Removes user management related methods as they
  are moved to reana-server.

Signed-off-by: Dinos Kousidis <dinos.kousidis@cern.ch>
  • Loading branch information
dinosk committed Jul 9, 2018
1 parent 284cb18 commit 12571cb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 209 deletions.
69 changes: 0 additions & 69 deletions reana_client/api/client.py
Expand Up @@ -525,72 +525,3 @@ def upload_to_server(self, organization, workflow,
logging.info("Something went wrong while uploading {}".
format(fname))
return response

def get_user(self, id_, email, token):
"""Return the user matching the provided id or email.
:param id: UUID of the user.
:param email: Email of the user.
:param token: API token of an administrator.
:returns: A dictionary with the user information if found.
"""
try:
(response,
http_response) = self._client.api.get_user(
id_=id_,
email=email,
token=token
).result()

if http_response.status_code == 200:
return response
else:
raise Exception(
"Expected status code 200 but replied with "
"{status_code}".format(
status_code=http_response.status_code))

except HTTPError as e:
logging.debug(
'User could not be retrieved: '
'\nStatus: {}\nReason: {}\n'
'Message: {}'.format(e.response.status_code,
e.response.reason,
e.response.json()['message']))
raise Exception(e.response.json()['message'])
except Exception as e:
raise e

def create_user(self, email, token):
"""Create a new user with the provided id or email.
:param id: UUID of the user.
:param email: Email of the user.
:param token: API token of an administrator.
:returns: Ok.
"""
try:
(response,
http_response) = self._client.api.create_user(
email=email,
token=token
).result()

if http_response.status_code == 201:
return response
else:
raise Exception(
"Expected status code 201 but replied with "
"{status_code}".format(
status_code=http_response.status_code))

except HTTPError as e:
logging.debug(
'User could not be retrieved: '
'\nStatus: {}\nReason: {}\n'
'Message: {}'.format(e.response.status_code,
e.response.reason,
e.response.json()['message']))
raise Exception(e.response.json()['message'])
except Exception as e:
raise e
3 changes: 1 addition & 2 deletions reana_client/cli/__init__.py
Expand Up @@ -28,7 +28,7 @@

from reana_client.api import Client
from reana_client.cli import analyses, workflow, inputs, outputs, \
ping, code, status, users
ping, code, status

DEBUG_LOG_FORMAT = '[%(asctime)s] p%(process)s ' \
'{%(pathname)s:%(lineno)d} ' \
Expand Down Expand Up @@ -82,4 +82,3 @@ def cli(ctx, loglevel):
cli.add_command(outputs.outputs)
cli.add_command(code.code)
cli.add_command(status.status)
cli.add_command(users.users)
119 changes: 0 additions & 119 deletions reana_client/cli/users.py

This file was deleted.

62 changes: 43 additions & 19 deletions reana_client/openapi_connections/reana_server.json
Expand Up @@ -1085,10 +1085,10 @@
"operationId": "get_user",
"parameters": [
{
"description": "Required. The email of the user.",
"description": "Not required. The email of the user.",
"in": "query",
"name": "email",
"required": true,
"required": false,
"type": "string"
},
{
Expand All @@ -1098,6 +1098,13 @@
"required": false,
"type": "string"
},
{
"description": "Not required. API key of the admin.",
"in": "query",
"name": "user_token",
"required": false,
"type": "string"
},
{
"description": "Required. API key of the admin.",
"in": "query",
Expand All @@ -1111,27 +1118,37 @@
],
"responses": {
"200": {
"description": "User was found. Returns all stored user information.",
"description": "Users matching criteria were found. Returns all stored user information.",
"examples": {
"application/json": {
"email": "user@reana.info",
"id": "00000000-0000-0000-0000-000000000000",
"token": "Drmhze6EPcv0fN_81Bj-nA"
}
"application/json": [
{
"email": "user@reana.info",
"id": "00000000-0000-0000-0000-000000000000",
"token": "Drmhze6EPcv0fN_81Bj-nA"
},
{
"email": "user2@reana.info",
"id": "00000000-0000-0000-0000-000000000001",
"token": "Drmhze6EPcv0fN_81Bj-nB"
}
]
},
"schema": {
"properties": {
"email": {
"type": "string"
},
"id_": {
"type": "string"
"items": {
"properties": {
"email": {
"type": "string"
},
"id_": {
"type": "string"
},
"token": {
"type": "string"
}
},
"token": {
"type": "string"
}
"type": "object"
},
"type": "object"
"type": "array"
}
},
"403": {
Expand Down Expand Up @@ -1167,6 +1184,13 @@
"required": true,
"type": "string"
},
{
"description": "Required. API key of the user.",
"in": "query",
"name": "user_token",
"required": false,
"type": "string"
},
{
"description": "Required. API key of the admin.",
"in": "query",
Expand Down Expand Up @@ -1221,4 +1245,4 @@
},
"swagger": "2.0",
"tags": []
}
}

0 comments on commit 12571cb

Please sign in to comment.