Commit Graph

281 Commits

Author SHA1 Message Date
Ken Tsang
bcc45ede9c Refactored code for new service permissions 2017-06-23 14:27:41 +01:00
kentsanggds
01760f3405 Merge pull request #1327 from alphagov/create-inbound-api
Create inbound api
2017-06-22 12:36:28 +01:00
Ken Tsang
c5e1de9b33 Enable update of url / bearer_token inbound api 2017-06-21 17:34:22 +01:00
Ken Tsang
d3d0c0c0b6 Add create_service_inbound_api 2017-06-20 13:29:20 +01:00
Ken Tsang
d9286b036f Add get and update service inbound api 2017-06-20 13:06:46 +01:00
Leo Hemsted
580c225ca2 Change client_request so its kwargs look more like url_for 2017-06-19 12:31:14 +01:00
Leo Hemsted
c5f92eabfb add add one-off notification status
completely mimicks the job status page, and as such, all the code and
templates have been taken from the job page. This page performs
exactly the same as the job page for now

* total, sending, delivered, failed blue boxes (though they'll just
  read 0/1 for now.
* download report button (same as with job download, except without job
  or row number in file)
* removed references to scheduled
* kept references to help (aka tour/tutorial) as that'll eventually
  change over from a job to a one-off too
2017-06-16 15:28:17 +01:00
Rebecca Law
703b48b157 [WIP]
Page and form to persist the inbound api data for a service.
2017-06-15 16:20:07 +01:00
Chris Hill-Scott
f6d8e55579 Add two-way messaging view
> Once an inbound message has been received, there should be a way to
> see the other messages in the system from the same service to the same
> number. Both in and outbound. Nice inbox/whatsapp stylee view or some
> such. This way the context of the reply is understood.
>
> Initially will only see the outbound template, not the actual message,
> but we’re going to change this for the rest (soon), so that you can
> always see the full message for all outbound.
2017-06-10 12:03:10 +01:00
Martyn Inglis
784be721f4 Merge branch 'master' into reinstate-new-rate-api
Conflicts:
	app/main/views/dashboard.py
2017-06-07 14:44:27 +01:00
Chris Hill-Scott
e373296bd9 Show inbound messages on the dashboard
This commit adds two things:

a section on the dashboard to show how many inbound messages the
service has received in the last 7 days, and how recently an inbound
message has been received
---

Doesn’t show the contents of any messages, just like how the rest of the
dashboard is an aggregation, never individual messages.

a page to show all the inbound messages the service has received in
the last 7 days
---

This shows the first line of the message. Eventually this will link
through to a ‘conversation’ page, where a service can see all the
messages it’s received from a given phone number.
2017-06-05 15:42:36 +01:00
Rebecca Law
fe24501075 Add a platform admin button to service-settings page to turn the inbound_sms messaging on and off.
If clicked you will be prompted to enter a sms sender number, when setting the permission on or off.
Team members will always be able to see the number, but will only be able to change it if the inbound_sms permission is off.
2017-06-02 16:33:31 +01:00
Martyn Inglis
0dbd3fa10d Revert "Merge pull request #1288 from alphagov/add-new-rate-logic"
This reverts commit adbff63d1f, reversing
changes made to 80f0b4b2a2.
2017-06-02 10:41:42 +01:00
minglis
adbff63d1f Merge pull request #1288 from alphagov/add-new-rate-logic
Wire in the new API method that calculates the total cost and total billable units
2017-06-02 09:52:19 +01:00
Chris Hill-Scott
f41830e5d3 Add query string parameter to search by recipient
> Service teams that use the admin interface often need to know the
> outcome of a message... at the moment they have to page through all
> the results in the activity stream. They should be able to find
> notifications by email address or phone number.

– https://www.pivotaltracker.com/n/projects/1443052

This commit adds an additional query string parameter (`to`) to the URL,
which users can use to filter down the list of notifications.

It:
- takes the status into account
- doesn’t update the counts based on the search term (in reality each
  service will only send a handful of notifications to one person in any
  7 day period)

In other words the funnel that filters down the notifications looks
like:

> all notifications for service → only failed → only to this phone
> number
2017-05-30 15:06:56 +01:00
Martyn Inglis
52326539d6 Wire in the new API method that calculates the total cost and total billable units.
- Used on dashboard to calculate free tier/cost
- Update tests to mock new method
- Two new tests to check output on dashboard page
2017-05-24 10:35:52 +01:00
Ken Tsang
53e78c2b60 Update page to handle international stats 2017-04-28 14:49:41 +01:00
Leo Hemsted
cf125d0a14 add sent as a new status
functions as delivered - shows up in delievered column, contributes
to delivered stats etc.
2017-04-27 16:17:10 +01:00
kentsanggds
e37ce051e7 Merge pull request #1240 from alphagov/add-international-sms-feature-flag
Add international sms feature flag
2017-04-25 19:09:07 +01:00
Chris Hill-Scott
f3e69a808e Fix setting and display of letter branding
API and Admin were not using the same name for the organisation ID that
we have set with DVLA.
2017-04-24 14:46:19 +01:00
Ken Tsang
b1706fd213 Updated service settings for international sms 2017-04-24 13:52:10 +01:00
Chris Hill-Scott
eb9214978e Merge pull request #1234 from alphagov/letter-branding
Add platform admin setting for letter branding
2017-04-24 10:33:39 +01:00
Chris Hill-Scott
75f5829c1e Get organisations list from API rather than config
Hard coding the organisations means this information is duplicated
between the admin and the API, and could get out of sync.
2017-04-24 10:25:37 +01:00
Chris Hill-Scott
61470391bf Add platform admin setting for letter branding
Does two main things:
- defines what ‘brands’ we support, in terms of the ID that DVLA use
- adds a form to choose which branding a service uses (currently
  platform admin only, like email branding)

By doing this we will be able to (with some more work) preview and send
letters with a variety of different branding.

Story: https://www.pivotaltracker.com/story/show/143506905
2017-04-24 10:25:36 +01:00
Imdad Ahad
99805fb592 Add extra flag to indicate we want a csv notification response 2017-04-20 15:18:47 +01:00
Ken Tsang
e5a377edd8 Add letter jobs page, client and test 2017-04-11 10:59:50 +01:00
Leo Hemsted
2bb0cba430 add new letter job statuses to job api client
add test to test_dashboard to confirm we're getting for the right queus
2017-04-07 11:08:40 +01:00
Chris Hill-Scott
4a226a7a29 Show template usage broken down by month
This follows on from:
- https://github.com/alphagov/notifications-admin/pull/1094
- https://github.com/alphagov/notifications-admin/pull/1109

It depends on:
- [ ] https://github.com/alphagov/notifications-api/pull/829

A year is too long. Month-by-month is a better timeframe for making
decisions or seeing patterns in your usage.
2017-03-16 14:04:37 +00:00
Chris Hill-Scott
4e0ef92415 🖨
f5166bec79/app/notify_client/service_api_client.py (L143)
2017-03-14 13:03:03 +00:00
Imdad Ahad
276a072a54 Add logging for streaming contents 2017-03-13 14:53:19 +00:00
imdadahad
2391410435 Merge pull request #1170 from alphagov/feat-add-who-updated-providers
Show who updated providers and provider history data
2017-03-08 16:43:07 +00:00
Chris Hill-Scott
f54689a2b7 Merge pull request #1168 from alphagov/contact-letter-block
add letter_contact_block edit fields
2017-03-06 11:11:54 +00:00
Leo Hemsted
1cacd92411 Merge pull request #1153 from alphagov/forget-me
Remove remember me cookie
2017-03-06 09:39:52 +00:00
Leo Hemsted
5c3588445e add letter_contact_block edit fields
no actual template functionality yet - just the ability for services
that have letters enabled to edit a 10 line block that will go on the
top right hand side of their letters with contact information
2017-03-03 16:18:59 +00:00
Imdad Ahad
faf35a814d Add provider client method to get provider version history 2017-03-02 22:50:01 +00:00
Rebecca Law
35f61125e8 Fix the user flow when the user account is locked.
The user has 10 tries at the password, after which the account is locked.
The same is true for the verify code, the user will have 10 tries before the user account is locked.
2017-02-28 14:41:31 +00:00
Rebecca Law
2d4e0a0631 Added a reset of failed_login_count when the user is activated.
Update user from the update-password api call (which resets the failed_login_count)
2017-02-28 11:56:40 +00:00
Leo Hemsted
9fda5d1847 remove remember_me cookie and related code 2017-02-27 15:18:18 +00:00
Leo Hemsted
4df12f5f4e ensure other 2FA pages also handle session id
specifically, the 2FA page when you first create an account is different to the login 2FA page
and also the 2FA page when you change your phone number is different as well
2017-02-24 16:32:59 +00:00
Leo Hemsted
5aeaa69f5f fix logged_in_elsewhere to work when user never logged in before (new accounts) 2017-02-23 16:38:18 +00:00
Leo Hemsted
f14a836baa check users' session id.
when a user enters their 2FA code, the API will store a random UUID
against them in the database - this code is then stored on the cookie
on the front end.

At the beginning of each authenticated request, we do the following
steps:
  * Retrieve the user's cookie, and get the user_id from it
  * Request that user's details from the database
  * populate current_user with the DB model
  * run the login_required decorator, which calls
    current_user.is_authenticated

is_authenticated now also checks that the database model matches the
cookie for session_id. The potential states and meanings are as follows:

 database | cookie | meaning
----------+--------+---------
 None     | None   | New user, or system just been deployed.
          |        | Redirect to start page.
----------+--------+---------
 'abc'    | None   | New browser (or cleared cookies). Redirect to
          |        | start page.
----------+--------+---------
 None     | 'abc'  | Invalid state (cookie is set from user obj, so
          |        | would only happen if DB is cleared)
----------+--------+---------
 'abc'    | 'abc'  | Same browser. Business as usual
----------+--------+---------
 'abc'    | 'def'  | Different browser in cookie - db has been changed
          |        | since then. Redirect to start
2017-02-22 17:31:13 +00:00
Imdad Ahad
5017267210 Remove reset failed count 2017-02-20 15:07:37 +00:00
imdadahad
cdd192590f Merge pull request #1106 from alphagov/feat-update-user-profile-password-with-new-endpoint
Update password on user profile with new endpoint
2017-02-10 17:23:46 +00:00
Chris Hill-Scott
ac9d4f2daf Break down usage by month, filter by year
The previous, weekly activity breakdown was what we reckoned might be
useful. But now that we have people using the platform it feels like
aggregating a service’s usage by month is:
- matches the timeframe users report on within their organisation
- is consistent with the usage page

And like the usage page this commit also limits the page to only show
one financial year’s worth of data at once (rather than data for all
time).

This commit also makes some changes to the jobs view code so that our
aggregation of failure states is consistent between the dashboard pages
and the jobs pages.
2017-02-08 10:59:26 +00:00
Imdad Ahad
7ad56df78b Change user api client to update password with new endpoint 2017-02-07 13:31:46 +00:00
Chris Hill-Scott
2a502753a4 Filter and navigate usage by financial year
Right now we tell people that the usage page is for the current
financial year. This is a lie – it’s for all time.

So this commit calls through to the API to get the stats for (by
default) the current financial year.

We already do this for the monthly breakdown, this just does the same
thing for the yearly totals.

It also adds navigation to show the data for other financial years:
- previous so you can go back and see your usage and verify that the
  bill you’re about to pay is correct
- next so that you can check what your SMS allowance is going to be
  before you actually get into it
2017-02-06 12:25:48 +00:00
Rebecca Law
26974886ec Add Suspend and Resume service buttons to service-settings page. 2017-01-31 15:56:06 +00:00
Rebecca Law
6d883b59ad Changed deactivate service to archive service.
need to deploy https://github.com/alphagov/notifications-api/pull/808 first
2017-01-31 09:54:51 +00:00
Rebecca Law
3dfb3806d2 Add a selectField to edit and create templates that is only visible for platform admins that makes the template a priority template.
There is a check that the template can not be created as priority if the user is not a platform admin.
There is a check that the template can not change the `priority` unless they are a platform admin.
2017-01-18 15:11:34 +00:00
Leo Hemsted
d56b7b9a58 block inactive services from making stateful changes
in the NotifyAdminAPIClient, which all api traffic goes through, return
403 for any stateful requests (post, put and delete), if the following
criteria have been met:
* a current_service is set
    (this prevents checks being carried out on non-service related
     updates, eg editing user details)
* the service is not active
* the current user is not a platform admin

so platform admins can still update anything.

Note: Without any specific error handling, the user will see a generic
403 page. This is fine, probably - it's a relatively niche case that
you'll be editing a service you can't get to anyway
2016-12-09 16:09:42 +00:00