Commit Graph

8044 Commits

Author SHA1 Message Date
Leo Hemsted
ebd4eda8bd remove duplicate dao invite fns and improve naming 2021-03-12 13:56:05 +00:00
Leo Hemsted
58896e194d add new invite/<token_type>/check/<token> endpoint
having `/invite/service/<token>` and `/invite/service/<id>` as two
separate routes (the first to validate an invite token, the second to
retrieve invite metadata) technically works. Routes are matched from
first to last until a match is found. The metadata endpoint only accepts
UUIDs, so requests with a UUID will be picked up by the correct
endpoint, while requests that don't look like a UUID will carry on
searching for an endpoint, and will find the token validation endpoint.

So while this works correctly for our normal expected input, it only
does so _because the UUID endpoint is first in the file_. This isn't
great, and it makes it harder to reason about the URLs when looking at
them.

To solve this, create the new `invite/service/check/<token>` endpoint.
For backwards compatibility, assign this in parallel with the existing
route - once the admin uses the new route we can remove the old route
and make better guarantees about what endpoint is being hit.
2021-03-12 13:56:01 +00:00
Leo Hemsted
eab4a75e29 remove the global_invite (accept_invite) endpoint
move the endpoints into service_invite/rest.py and
organisation/invite_rest.py respectively. Remove the prefix from all the
blueprints to allow this.
2021-03-12 13:55:55 +00:00
Leo Hemsted
4471189b87 add endpoints to fetch a user based on their ID only
this functions the same as `validate_invitation_token`, but without
having the signed token, instead just the ID. This is so later endpoints
within the invite flow can also fetch the invited user
2021-03-12 13:55:44 +00:00
Leo Hemsted
d94d0bc8d7 rename invite blueprints
nb: the routes are not changing as part of this, only file paths and
blueprint names.

invite -> service_invite

this blueprint handles fetching invites for a service, creating invites,
etc.

accept_invite -> global_invite

this blueprint handles accepting invites for now, but will also involve
retrieving service/org user invite data without knowing the service/org
id associated. i'm not in love with this name and open to suggestions,
but i wanted to contrast it from service_invite and
organisation/invite_rest.py.
2021-03-12 13:55:43 +00:00
Ben Thorner
b0c531f5cb Merge pull request #3175 from alphagov/add-isort
Add isort to build and fix issues
2021-03-12 11:54:21 +00:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
Ben Thorner
321b4913ed Enforce consistency in imports as part of build
This copies the config we use in the admin app, with a few changes
as discussed in the PR [1]. We'll apply these to our other apps.

[1]: https://github.com/alphagov/notifications-api/pull/3175#issuecomment-795530323
2021-03-12 11:45:21 +00:00
David McDonald
a2cc0df5a7 Merge pull request #3167 from alphagov/broadcast_services_history
Add service versioning to broadcast account type change
2021-03-11 17:07:24 +00:00
Rebecca Law
2fabd59cf4 Merge pull request #3176 from alphagov/fix-update-notification-method
Refactor method for deciding the failure type
2021-03-11 14:34:50 +00:00
Rebecca Law
19f7a6ce38 Refactor method for deciding the failure type 2021-03-10 14:39:55 +00:00
Rebecca Law
a7a504a599 Merge pull request #3173 from alphagov/performance-platform-endpoints
Add an endpoint to return all the data required for the performance platform page
2021-03-10 13:27:08 +00:00
Rebecca Law
11d10d5293 Rename to performance_dashboard
Fix totals to return totals for all time rather than for date range.
Added more test data
2021-03-10 13:16:25 +00:00
Ben Thorner
6db9a7a2f2 Merge pull request #3170 from alphagov/quiet-pytest
Quieten output for pytest
2021-03-09 08:51:16 +00:00
Ben Thorner
94718c1d29 Quieten output for pytest
This avoids being verbose by default, which is consistent with how
we configure pytest for the admin app [1].

[1]: https://github.com/alphagov/notifications-admin/blob/master/pytest.ini#L16
2021-03-08 17:44:48 +00:00
David McDonald
ff11f39ce4 Merge pull request #3165 from alphagov/pyup-scheduled-update-2021-03-03
Scheduled weekly dependency update for week 09
2021-03-08 17:02:27 +00:00
David McDonald
289c0ea0c6 Make freeze requirements 2021-03-08 15:56:42 +00:00
David McDonald
8cf32d6f22 Add service versioning to broadcast account type change
We are using the `set_broadcast_service_type` route to make changes to
service objects. However, we had forgotten to add the `version_class`
decorator to it which will mean the changing of a service going from
training to live mode will also be recorded in the services_history
table for free. Whilst not essential, this easy change makes things more
consistent for how we update other services.
2021-03-08 14:09:24 +00:00
Leo Hemsted
dabdc2c4ac Merge pull request #3169 from alphagov/remove-old-user-email-endpoint
add POST get user by email endpoint
2021-03-05 14:06:57 +00:00
Leo Hemsted
e0234fecba add POST get user by email endpoint
the existing endpoint is a GET, and so leaves email addresses in log
files.

we've got an existing POST find_users_by_partial_email, but not one that
matches on a whole email address.
2021-03-05 12:58:45 +00:00
David McDonald
6b535fe946 Merge pull request #3166 from alphagov/email-auth-broadcast-bug
Email auth broadcast bug
2021-03-05 09:59:59 +00:00
Rebecca Law
b06850e611 Add an endpoint to return all the data required for the performance
platform page.
2021-03-05 09:59:03 +00:00
David McDonald
fcf667f09c Add test coverage for setting service permission
Spotted that we aren't testing all our permission types here so added
this one in.

It includes the TODO for allowing the API to give a service the
broadcast permission. We don't want this to happen, we want them to use
the `set_as_broadcast_service` route instead. We will probably get away
with it for the moment for it would be tighter validation we should add
to reduce the risk of letting a service get in a dodgy state.
2021-03-03 18:49:40 +00:00
David McDonald
0ce539704e Fix bug with removing email auth for broadcast service
We accidently were removing the ability for a service to do email auth
if it was a broadcast service with email auth. This fixes it.

Note, it might be up for debate later whether we let broadcast services
use email auth (I think we should) so this might change in time, but we
will fix this bug regardless.

Note, worth glancing at `SERVICE_PERMISSION_TYPES` which contains a list
of permissions that a service might have to make sure I haven't missed
any others. The one that looks potentially dodgy is the
`EDIT_FOLDER_PERMISSIONS` permission but I can't see this being used
anywhere in the API or the admin app so think it is likely now defunct
and a user level permission so we don't need to worry about it.
2021-03-03 18:34:24 +00:00
pyup-bot
9f39118991 Update notifications-python-client from 5.7.1 to 6.0.2 2021-03-03 13:00:06 +00:00
pyup-bot
b5f5114c59 Pin cryptography to latest version 3.4.6 2021-03-03 13:00:06 +00:00
pyup-bot
80891199f8 Update cachetools from 4.2.0 to 4.2.1 2021-03-03 13:00:05 +00:00
pyup-bot
8067ebdca5 Update sqlalchemy from 1.3.22 to 1.3.23 2021-03-03 13:00:05 +00:00
pyup-bot
49dac21739 Update pyjwt from 2.0.0 to 2.0.1 2021-03-03 13:00:05 +00:00
pyup-bot
b615f7192f Update marshmallow-sqlalchemy from 0.23.1 to 0.24.0 2021-03-03 13:00:04 +00:00
pyup-bot
e05ae8f413 Update iso8601 from 0.1.13 to 0.1.14 2021-03-03 13:00:04 +00:00
pyup-bot
6371975981 Update eventlet from 0.30.0 to 0.30.1 2021-03-03 13:00:03 +00:00
pyup-bot
d56430b3a8 Update flask-migrate from 2.5.3 to 2.7.0 2021-03-03 13:00:03 +00:00
pyup-bot
83c5a4f67c Update cffi from 1.14.4 to 1.14.5 2021-03-03 13:00:03 +00:00
Richard Baker
30eb98c140 Merge pull request #3164 from alphagov/cell_broadcast_ee_prod
Enable EE Cell Broadcasts in production environment
2021-03-02 09:46:23 +00:00
Richard Baker
2e4ac1f09c Enable EE Cell Broadcasts in production environment
Removes the configuration override for Live, so the base configuration is
used, enabling cell broadcasting for all MNOs.

Signed-off-by: Richard Baker <richard.baker@digital.cabinet-office.gov.uk>
2021-03-02 09:34:35 +00:00
Rebecca Law
08b157df87 Merge pull request #3162 from alphagov/change-dvla-addres-to-list
Change DVLA_EMAIL_ADDRESS to a list
2021-02-26 13:38:06 +00:00
Rebecca Law
3df334d099 Simplify config and add json loads 2021-02-26 12:19:03 +00:00
Rebecca Law
acfb759cb9 Change DVLA_EMAIL_ADDRESS to a list 2021-02-26 11:21:16 +00:00
Rebecca Law
b120b83cc7 Merge pull request #3157 from alphagov/persist-performance-data
Persist the processing time statistics to the database.
2021-02-26 09:09:41 +00:00
Rebecca Law
e105257925 Fix db migration merge conflicts 2021-02-26 08:38:36 +00:00
Rebecca Law
3099c51e12 Command to load the processing time data for the new ft_processing_time
data.
2021-02-26 07:49:49 +00:00
Rebecca Law
1797a993e7 Fix db migration conflict 2021-02-26 07:49:49 +00:00
Rebecca Law
0849070eca Add created_at and updated_at columns to ft_processing_time 2021-02-26 07:49:49 +00:00
Rebecca Law
21edf7bfdd Persist the processing time statistics to the database.
The performance platform is going away soon. The only stat that we do not have in our database is the processing time. Let me clarify the only statistic we don't have in our database that we can query efficiently is the processing time. Any queries on notification_history are too inefficient to use on a web page.
Processing time = the total number of normal/team emails and text messages plus the number of messages that have gone from created to sending within 10 seconds per whole day. We can then easily calculate the percentage of messages that were marked as sending under 10 seconds.
2021-02-26 07:49:49 +00:00
David McDonald
82e5a1804b Merge pull request #3155 from alphagov/migrate-broadcast-settings
Backfill services_broadcast_settings table
2021-02-25 12:16:36 +00:00
Rebecca Law
1b22de3830 Merge pull request #3161 from alphagov/check-use_numeric_sender
Check international rules to decide on a sender
2021-02-25 09:36:29 +00:00
Rebecca Law
97d1bfaee8 Rename method for clarity
Added unit test for new method.
2021-02-25 08:10:52 +00:00
Rebecca Law
11bd906338 Update utils to get the new function 2021-02-24 16:56:33 +00:00
Rebecca Law
5986a65005 Check international number for alpha: NO if true then use number to send
SMS.

This is not a catch all for international SMS, the rules are quite
complex and still not completely understood. We are talking with our
provider who maybe able to sort this out for us. But in the meantime,
this should solve for the case that we understand.
2021-02-24 15:12:03 +00:00