Skip to content
Snippets Groups Projects
Commit 98a62e5d authored by Megan Henning's avatar Megan Henning Committed by GitHub
Browse files

Merge pull request #472 from scitran/fix-user-list

Fix bug passing parameters within userauth.py
parents 3ba833d2 64914879
No related branches found
No related tags found
No related merge requests found
Showing with 177 additions and 42 deletions
......@@ -34,6 +34,6 @@ def list_permission_checker(handler):
def f(method, query=None, projection=None):
if handler.public_request:
handler.abort(403, 'public request is not authorized')
return exec_op(method, query, projection)
return exec_op(method, query=query, projection=projection)
return f
return g
{
"_id": "jane.doe@gmail.com",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane.doe@gmail.com",
"root": false
}
[
{"_id":"jane.doe@gmail.com","firstname":"Jane","lastname":"Doe","email":"jane.doe@gmail.com"}
]
\ No newline at end of file
[{
"_id": "jane.doe@gmail.com",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane.doe@gmail.com",
"root": true,
"created": "2016-09-02T22:58:18.624000+00:00",
"modified": "2016-09-02T22:58:18.624000+00:00"
}]
{"_id":"jane.doe@gmail.com","firstname":"Jane","lastname":"Doe","email":"jane.doe@gmail.com"}
\ No newline at end of file
{
"_id": "jane.doe@gmail.com",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane.doe@gmail.com",
"root": false,
"created": "2016-09-02T22:58:18.624000+00:00",
"modified": "2016-09-02T22:58:18.624000+00:00"
}
......@@ -12,7 +12,7 @@ post:
is: [validates-json-body]
body:
application/json:
example: !include ../examples/user_jane_doe.json
example: !include ../examples/input/user-new.json
schema: !include ../schemas/input/user-new.json
responses:
200:
......@@ -30,7 +30,7 @@ post:
body:
application/json:
example: !include ../examples/user_jane_doe.json
schema: !include ../schemas/output/user.json
schema: !include ../schemas/output/user-self.json
/self/avatar:
description: Current user's avatar
get:
......
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties":{
"key": {"type": "string"},
"created": {},
"last_used": {}
},
"additionalProperties": false
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref":"user.json#",
"additionalProperties":{
"properties": {
"_id": {
"maxLength": 64,
"minLength": 2,
"pattern": "^[0-9a-z.@_-]*$",
"title": "ID",
"type": "string"
},
"firstname": {
"maxLength": 64,
"minLength": 1,
"title": "First Name",
"type": "string"
},
"lastname": {
"maxLength": 64,
"minLength": 1,
"title": "Last Name",
"type": "string"
},
"email": {
"format": "email",
"title": "Email",
"type": "string"
},
"avatars": { "$ref": "avatars.json"},
"avatar": {
"format": "uri",
"title": "Avatar",
"type": "string"
},
"root": { "type": "boolean"},
"disabled": { "type": "boolean"},
"preferences": {
"title": "Preferences",
"type": "object"
},
"created":{"type":"string"},
"modified":{"type":"string"}
},
"required":[
"_id", "firstname", "lastname",
"root", "email", "created", "modified"
]
],
"additionalProperties":false
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Group",
"type": "object",
"properties": {
"gravatar": {"type": ["string", "null"], "format": "uri" },
"provider": {"type": ["string", "null"], "format": "uri" },
"custom": {"type": ["string", "null"], "format": "uri" }
},
"additionalProperties": false
"$ref":"../definitions/avatars.json"
}
......@@ -2,7 +2,8 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "User",
"type": "object",
"$ref":"../definitions/user.json#",
"additionalProperties": false,
"allOf":[
{"$ref":"../definitions/user.json#"}
],
"required":["_id", "firstname", "lastname"]
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref":"../definitions/user.json#"
"title": "User",
"type": "object",
"allOf":[
{"$ref":"../definitions/user.json#"}
]
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Group",
"type": "object",
"properties": {
"gravatar": {"type": ["string", "null"], "format": "uri" },
"provider": {"type": ["string", "null"], "format": "uri" },
"custom": {"type": ["string", "null"], "format": "uri" }
},
"additionalProperties": false
"$ref":"../definitions/avatars.json"
}
......@@ -21,7 +21,7 @@
"title": "Email",
"type": "string"
},
"avatars": { "$ref": "avatars.json"},
"avatars": { "$ref": "../definitions/avatars.json"},
"avatar": {
"title": "Avatar",
"type": "string"
......@@ -33,15 +33,8 @@
"type": "object"
},
"api_key": {
"type": "object",
"properties": {
"key": {"type": "string"},
"created": {},
"last_used": {}
},
"additionalProperties": false
"$ref":"../definitions/user-api_key.json"
}
},
"additionalProperties": false,
"required":["_id", "firstname", "lastname", "created", "modified", "root"]
......
{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"_id": {
"maxLength": 64,
"minLength": 2,
"pattern": "^[0-9a-z.@_-]*$",
"title": "ID",
"type": "string"
},
"firstname": {
"maxLength": 64,
"minLength": 1,
"title": "First Name",
"type": "string"
},
"lastname": {
"maxLength": 64,
"minLength": 1,
"title": "Last Name",
"type": "string"
},
"email": {
"format": "email",
"title": "Email",
"type": "string"
},
"avatars": { "$ref": "../definitions/avatars.json"},
"avatar": {
"format": "uri",
"title": "Avatar",
"type": "string"
},
"root": { "type": "boolean"},
"disabled": { "type": "boolean"},
"preferences": {
"title": "Preferences",
"type": "object"
},
"api_key": {
"$ref":"../definitions/user-api_key.json"
},
"created":{"type":"string"},
"modified":{"type":"string"}
},
"required":[
"_id", "firstname", "lastname",
"root", "email", "created", "modified"
],
"additionalProperties":false
}
......@@ -2,7 +2,7 @@
"variables": [],
"info": {
"name": "test",
"_postman_id": "a0f19409-88fa-06e1-41b2-e377fa373af1",
"_postman_id": "e4301b09-a091-741e-e9ba-6fe23acd14e6",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
......@@ -41,6 +41,40 @@
},
"response": []
},
{
"name": "/users missing required",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": "tests[\"Status code is 400\"] = responseCode.code === 400;\n\ntests[\"Body has validation error message\"] = responseBody.has(\"'firstname' is a required property\");"
}
}
],
"request": {
"url": "{{baseUri}}/users?root=true",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "scitran-user {{test_user_api_key}}",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\"_id\":\"jane.doe@gmail.com\", \"lastname\":\"Doe\",\"email\":\"jane.doe@gmail.com\"}"
},
"description": "\n\n"
},
"response": []
},
{
"name": "Test /engine upload - type \"analysis\"",
"event": [
......@@ -69,8 +103,7 @@
"key": "file1",
"type": "file",
"enabled": true,
"value": "engine-analyses-1.txt",
"src":"test/integration_tests/postman/test_files/engine-analyses-1.txt"
"src": "test/integration_tests/postman/test_files/engine-analyses-1.txt"
},
{
"key": "metadata",
......@@ -85,4 +118,4 @@
"response": []
}
]
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment