Add card numbers and updating to auth server

This commit is contained in:
2018-11-10 19:33:41 -07:00
parent 6ec97db073
commit 790725c29e
6 changed files with 81 additions and 5 deletions
+41 -3
View File
@@ -54,6 +54,13 @@ In subsequent requests, the token key should be included in the `Authorization`
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
```
Example authenticated request:
```
curl -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" http://tools-auth.protospace.ca/user/
```
### For anonymous users
#### GET `/tooldata/`
@@ -128,10 +135,11 @@ Example response:
```
[
{
"username": "admin",
"username": "tanner.collin",
"profile": {
"url": "http://tools-auth.protospace.ca/profile/1/",
"user": "admin",
"url": "http://tools-auth.protospace.ca/profile/2/",
"user": "tanner.collin",
"card": "00000A4123",
"authorized_tools": [
"table-saw",
"jointer"
@@ -173,3 +181,33 @@ Get a list of all profiles.
Get a specific profile, or modify an existing one.
Here you can authorize users on tools or make them another lockout admin.
#### PUT `/update-cards/`
Send a dictionary of username=card_number pairs to update any profiles already in the system. Users not already registered will be ignored.
Responds with the number of profiles updated.
Operation is idempotent.
Example PUT data:
```
{
"tanner.collin": "00000A4123",
"matthew.mulrooney": "00000B8567",
"not-a-member": "539830843A"
}
```
Example response:
```
{"updated":2}
```
Example request:
```
curl -X PUT -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" -d tanner.collin=00000A4123 -d matthew.mulrooney=00000B8567 http://tools-auth.protospace.ca/update-cards/
```