Commit Graph

495 Commits

Author SHA1 Message Date
Adam Shimali
ac9adc292b [WIP] Change status code to 404 rather than 400. 2016-03-01 15:51:22 +00:00
Adam Shimali
993bdc8055 [WIP] use correct dao function for adding user to service.
Check for no user returned from user dao and return correct
error message.
2016-03-01 15:36:31 +00:00
Adam Shimali
3b66745677 [WIP] Start of api for accepting invite. 2016-03-01 14:13:38 +00:00
Rebecca Law
df278a8e6e Email invitation to an invited user.
New celery task to send the email.
2016-02-29 13:21:12 +00:00
Nicholas Staples
16e1ecb134 Working permissions and all tests passing.
Remove print statements.

Fix for review comments.
2016-02-26 15:00:29 +00:00
Rebecca Law
67af351f26 Fix get_users_by_service to return 404 if service does not exist.
Refactored service/rest.py so that all methods are returning a properly formatted error message so that the error message can deal with the response.
Refactoed errors.py to properly format the error message.
2016-02-25 12:11:51 +00:00
Rebecca Law
f1fdfbb308 Return empty list when there are no users for the service.
Added a test for when there are no users for the service.
Added a test_url_for - do we want to add this test and use url_for in our tests?
Or explictly write the url in the test?
2016-02-24 10:30:00 +00:00
Rebecca Law
12a2d8db0a New endpoint to get users for service id.
/service/<service_id>/users returns a list of all users associated with the service
2016-02-23 17:53:54 +00:00
Martyn Inglis
b01782bbe6 Send Email via the API
- uses the new subject/email from fields present on the templates / service tables
- brings the send email api call into line with the sms one.
- same fields (to/template_id)
- same rules regarding restricted services
- wired in as a task into celery

Requires
- new celery queue
- new env property (NOTIFY_EMAIL_DOMAIN)
2016-02-22 17:17:29 +00:00
Martyn Inglis
9bb95a53ec Updates to template endpoints:
- moved into templates rest class
- updated dao
- removed delete methods
- constraint on subject line
2016-02-22 12:55:18 +00:00
Martyn Inglis
98314485d3 Generate the email_from from the service name. 2016-02-19 17:07:59 +00:00
Martyn Inglis
1a136885c3 Update service rest class to handle new fields and updated dao 2016-02-19 15:53:45 +00:00
Adam Shimali
4f33b6f406 Wire up error handlers.
Replace some 400s with more appropriate 500s.

DAO methods that cause unexpected exceptions get caught and
logged by errors.py 500 error handler.
2016-02-17 17:04:50 +00:00
Rebecca Law
b5c662eca8 Change services.id to a UUID
Ideally all the primary keys in the db would be UUID in order to guarantee unique ids across distributed dbs.
This updates the services.id to a UUID. All the tables with a foreign key to the services.id are also updated.
The endpoints no longer state a data type of the <service_id> path param.
All the tests are updated to reflect this update.

The thing to pay attention to is the 0011_uuid_service_id.py migration script.
This commit must go with a commit on the notifications_admin app to keep things working.
There will be a small outage until both deploys have happened.
2016-02-02 14:22:22 +00:00
Nicholas Staples
2451f7e53d Added support for validation only of put requests. 2016-01-29 11:11:00 +00:00
Rebecca Law
5a937d6e71 Added user_id as a query param for get_services.
Need to add this query param for the services page on the admin app.
Do not add the query param to path in the token.
2016-01-22 12:47:59 +00:00
Nicholas Staples
e657958af4 Templates fix with tests working. 2016-01-22 10:44:34 +00:00
Rebecca Law
0027b62224 Updated get_api_keys endpoint to return one or many given key_id or not. 2016-01-21 12:13:17 +00:00
Rebecca Law
98c73e5bff Correction to url name 2016-01-20 16:34:30 +00:00
Rebecca Law
3e141e05cb Added tests for get api endpoint 2016-01-20 15:41:19 +00:00
Rebecca Law
9eb856b86e Get api_keys for service endpoint 2016-01-20 15:24:13 +00:00
Rebecca Law
2689d908c1 Update api-key/revoke endpoint to expire the key for the service.
Previously we assumed there was only one api key that was valid.
2016-01-20 14:48:44 +00:00
NIcholas Staples
4a3fae7580 Merge pull request #23 from alphagov/allow-multiple-api-keys
Allow multiple api keys
2016-01-20 14:13:29 +00:00
Nicholas Staples
4739f3fbd2 Added send_email endpoint. 2016-01-20 13:14:23 +00:00
Rebecca Law
27a381c3e9 Allow services to have multiple api keys.
/service/<service_id>/api-key/renew has been renamed to /service/<service_id>/api-key
/service/<service_id>/api-key now creates a token and no longer expires the existing api key.
Moved test for this endpoint to it's own file.
2016-01-20 10:57:46 +00:00
Rebecca Law
1db57dca8c Allow for multiple api keys for a service. 2016-01-19 18:25:21 +00:00
Rebecca Law
15b2d414cc Updates from review comments:
Update api_key relationship.
Check that id in dict exists before deleting it
2016-01-19 13:11:22 +00:00
Rebecca Law
4fc5c34320 Change Tokens to ApiKey
Added name to ApiKey model
2016-01-19 12:13:47 +00:00
Rebecca Law
b05ad17029 Remove trailing slashing from urls 2016-01-15 17:02:29 +00:00
Rebecca Law
0ad292300d Added authorization headers for all requests 2016-01-15 17:02:29 +00:00
Rebecca Law
d834277297 Fix code style 2016-01-14 16:24:25 +00:00
Rebecca Law
010408d98a Remove the view packages 2016-01-14 16:13:27 +00:00
Rebecca Law
436f45b70d Moved the _generate_token methods to the tokens_dao. 2016-01-14 11:30:45 +00:00
Rebecca Law
255dddaa27 Changed the token endpoints so that you can renew a token and revoke a token.
Updated create service so the token is created at that time
2016-01-14 10:18:11 +00:00
Rebecca Law
a6dda26ba1 Added test that the token can be signed and retrieved 2016-01-14 10:18:11 +00:00
Rebecca Law
725b976d31 Created endpoints for create and delete token. 2016-01-14 10:17:36 +00:00
Rebecca Law
3a3f9becec Add api_token model and dao 2016-01-14 10:15:28 +00:00
Nicholas Staples
99820b3e85 More tests for rest and dao. 2016-01-13 12:14:21 +00:00
Nicholas Staples
dad0fff4ba Template rest api skeleton added. 2016-01-13 11:04:13 +00:00
Nicholas Staples
31f10c7457 Added delete endpoint and tests. 2016-01-12 10:39:49 +00:00
Nicholas Staples
308e2cb7de More tests. 2016-01-12 09:28:01 +00:00
Nicholas Staples
2be72d3536 Add more tests. 2016-01-11 18:09:10 +00:00
Nicholas Staples
74547013ba All four http methods working now for user and service restful apis. 2016-01-11 17:19:06 +00:00
Nicholas Staples
49e98c21e7 Service and User API added, working with tests. Still need to polish the edges and add more tests. 2016-01-11 15:07:13 +00:00
Nicholas Staples
0bc4d02713 Work in progress, skeleton of the api created and testing started. Need to fix authentication tests. 2016-01-08 17:51:46 +00:00