Commit Graph

5089 Commits

Author SHA1 Message Date
Katie Smith
68fc6b5cb4 Merge pull request #1914 from alphagov/reject-sms-senders-starting-with-00
Update SMS sender validation to reject senders starting with 00
2018-03-01 13:56:23 +00:00
Katie Smith
d1c724d02c Merge pull request #1916 from alphagov/pyup-update-pytest-mock-1.7.0-to-1.7.1
Update pytest-mock to 1.7.1
2018-03-01 13:56:06 +00:00
Chris Hill-Scott
91a7858c45 Merge pull request #1910 from alphagov/env-sh-fix
hardcode some development values
2018-03-01 11:21:00 +00:00
pyup-bot
435f169c2a Update pytest-mock from 1.7.0 to 1.7.1 2018-03-01 11:17:59 +00:00
Chris Hill-Scott
75976f3b59 Merge pull request #1915 from alphagov/no-priority-example
Stop creating tour text messages as priority
2018-03-01 09:56:08 +00:00
Chris Hill-Scott
6d29587d3a Merge pull request #1913 from thomchambers/patch-3
Update Features page with new content
2018-03-01 09:56:02 +00:00
Chris Hill-Scott
70e37a1af5 Merge pull request #1912 from thomchambers/patch-2
Update Security page content
2018-03-01 09:55:55 +00:00
Chris Hill-Scott
76da1ab28d Stop creating tour text messages as priority
Since we send all one off messages as priority now[1], we don’t need to
explicitly mark this template as being priority.

This stops the (potential) problem of people skipping the tour, still
having this template and then modifying it to send other messages,
potentially in high volumes from CSV files or the API. I don’t think
this is a real problem now, but worth cleaning this up.

Currently:
- 827 priority templates in the database
- 195 of which are not deleted
- 18 of which are not called ‘Example text message template’
- 3 of which look like genuine use cases, not from services that we run

[1]: https://github.com/alphagov/notifications-api/pull/1722
2018-02-28 17:00:36 +00:00
thomchambers
aadc73645e Update Features page with new content
Edited some things in here based on user support tickets and new features we've added recently.
2018-02-28 16:11:04 +00:00
Chris Hill-Scott
e899e2e826 Make it clearer what you sign in using with
Avoid confusion between and email you’re sent and an email address that is your username.
2018-02-28 16:05:16 +00:00
thomchambers
e1b77e3b13 Update Security page content
Adding some new content based on feedback from user research.
2018-02-28 15:33:47 +00:00
Katie Smith
11a6c8cfb5 Update SMS sender validation to reject senders starting with 00
Having SMS senders that start with 00 can cause issues with Firetext due
to Firetext's validation rules, so we shouldn't allow SMS senders to start
with 00.

Firetext treats a double 00 at the start of the senderID as an international
prefix, so removes them. A sender of 00447876574016 would become 447876574016.

Under Firetext's validation rules, an SMS sender of five 0s (00000) would
become  4400. This is because the first 00 are removed (as the international
prefix). The third 0 is seen as the start of a phone number, and becomes 44,
leaving the final 00 = 4400.
2018-02-28 13:40:20 +00:00
Chris Hill-Scott
aae94c8c80 Merge pull request #1886 from alphagov/import-sort
Enforce order and style of imports
2018-02-28 10:43:56 +00:00
Chris Hill-Scott
f3a0c505bd Enforce order and style of imports
Done using isort[1], with the following command:
```
isort -rc ./app ./tests
```

Adds linting to the `run_tests.sh` script to stop badly-sorted imports
getting re-introduced.

Chosen style is ‘Vertical Hanging Indent’ with trailing commas, because
I think it gives the cleanest diffs, eg:
```
from third_party import (
    lib1,
    lib2,
    lib3,
    lib4,
)
```

1. https://pypi.python.org/pypi/isort
2018-02-27 16:35:13 +00:00
Leo Hemsted
11a4a08ccb hardcode some development values
this'll ensure that you won't get your dev secret keys out of sync
between api and admin
2018-02-27 15:55:20 +00:00
Chris Hill-Scott
0217a6a962 Merge pull request #1907 from alphagov/pyup-update-pytest-xdist-1.22.1-to-1.22.2
Update pytest-xdist to 1.22.2
2018-02-27 15:45:58 +00:00
Chris Hill-Scott
29c4984adc Merge pull request #1908 from alphagov/aws-noise
Rremove awscli and boto3 from requirements
2018-02-27 15:36:21 +00:00
Chris Hill-Scott
b731690736 Rremove awscli and boto3 from requirements
They're both brought in by utils, and are generating a lot of PR noise
by being on every repo.
2018-02-27 15:20:06 +00:00
Rebecca Law
81cceb1c44 Merge pull request #1901 from alphagov/becca-invite-users
Organisation invite users
2018-02-27 13:12:33 +00:00
pyup-bot
8b2e7d9681 Update pytest-xdist from 1.22.1 to 1.22.2 2018-02-27 10:44:14 +00:00
Rebecca Law
d638b446f5 Merge branch 'master' into becca-invite-users 2018-02-27 10:13:40 +00:00
Rebecca Law
41309721bd - Remove organisation setter for the user model.
- Revert the change to the log level for admin.
2018-02-26 22:18:46 +00:00
Rebecca Law
298eb77b54 Refactor the check token endpoint to use the newly merged api endpoints. 2018-02-26 11:50:40 +00:00
Chris Hill-Scott
c09b9d1f85 Merge pull request #1904 from alphagov/merge-all-the-things
Merge all the things
2018-02-26 10:03:11 +00:00
Chris Hill-Scott
2435a29672 Merge pull request #1838 from alphagov/beta-banned
Remove beta badge from header
2018-02-26 10:02:53 +00:00
Chris Hill-Scott
c16306a84e Explain what ‘beta’ means for Notify users 2018-02-26 09:35:59 +00:00
Chris Hill-Scott
59bb7bdd5d Don’t parametrize on government domains
There’s over 1000 domains in our file. This is too much for parametrize
to handle when running the tests on multiple cores. End up with this
error:
```
Different tests were collected between gw1 and gw2.
```
2018-02-26 08:53:48 +00:00
Chris Hill-Scott
9ca6bd0f24 Remove central orgs that haven’t signed MOU 2018-02-26 08:53:48 +00:00
Chris Hill-Scott
9cc6cc3da9 Mark all councils who haven’t signed the agreement
We only sign agreements for a whole council. Therefore we know that if
a council isn’t one of the ones who has signed an agreement, no part of
that council has signed the agreement, therefore it’s a `false` not a
`null`.
2018-02-26 08:53:48 +00:00
Chris Hill-Scott
c7d2155eeb Remove parish councils
There are a lot of them, and they’re probably too small to ever be using
Notify. They’re just bulking out the data unneccessarily.
2018-02-26 08:53:48 +00:00
Chris Hill-Scott
b2dd5cd8ae Talk about crown/non-crown not local/central
The thing that matters for which agreement an organisation has to sign
is whether or not that organisation is crown or non-crown.

There is only a partial overlap between crown/non-crown and
local/central. We can’t infer one fro the other. So this commit makes it
explicit by marking all local government organisations as non-crown,
which is something we can know for sure.

We don’t, for example, know the inverse, that all parts of all central
government organisations are crown bodies (but we can mark some of them
as being so later on).
2018-02-26 08:53:47 +00:00
Chris Hill-Scott
5404107842 Split email list out again
The list of email domains is a different list from the list of all
government domains. And because the list of all government domains is
really long now, it could be unnecessarily slow to search through when
(a lot of the time) all we care about is whether the email address ends
with `.gov.uk`.
2018-02-26 08:53:47 +00:00
Chris Hill-Scott
8b739ddc50 Make whitespace consistent 2018-02-26 08:53:47 +00:00
Chris Hill-Scott
9e8d69da7d Get rid of the regex
Regexes are hard to read, and this one is probably quite slow because
the string formatting means it can never be precompiled.
2018-02-26 08:53:47 +00:00
Chris Hill-Scott
be18448f2a Refactor to only sort once
Rather than doing the sort every time an instance is initiated, we can
speed things up by just doing it the once when the app starts up.
2018-02-26 08:53:47 +00:00
Chris Hill-Scott
641511ce12 Mark which councils have signed the agreement
This means we’ll be able to tell them for sure that they don’t need to
signed it again.

List taken from looking through the folder of signed agreements on
Google Drive.
2018-02-26 08:53:47 +00:00
Chris Hill-Scott
7f5f0ea02b Add list of local council domains
Taken from:
https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/655371/List_of_.gov.uk_domain_names_as_at_26_October_2017.csv/preview

Then filtered down to councils using this script:
```python
import clipboard
import csv
with open('List_of_.gov.uk_domain_names_as_at_26_October_2017.csv') as l:
    f = csv.reader(l)
    s = ''
    for row in f:
        if 'council' in row[1].lower():
            s = s + "{}:\n    sector: local\n    owner: {}\n".format(*row)
    clipboard.copy(s)
```
2018-02-26 08:53:47 +00:00
Chris Hill-Scott
20fe084ff1 Mark central and NHS organisations w/ signed MOUs
This adds information about which orgs have signed an MOU to the domain
list. The meaning of the attribute is:
- `true`: MOU signed for the whole organisation
- `false`: no MOU for any part of the organisation
- `null` (or missing): can’t be sure if it’s true or false
2018-02-26 08:53:46 +00:00
Chris Hill-Scott
f93ef2eb3d Convert domain list to YAML
YAML is easier to edit than Python code, and having it in the root
directory of the app makes it nice and easy to find.
2018-02-26 08:53:46 +00:00
Chris Hill-Scott
91ab54e9c1 Allow lookup of org details
This commit:
- makes the logic around looking up a domain a bit more sophisticated
  by matching on the longest domain name first
- exposes the details about an organisation to consumers of the
  `GovernmentDomain` class
2018-02-26 08:53:46 +00:00
Chris Hill-Scott
911fc3ff4c Start adding extra information about each domain
In some cases we can tell based on someone’s email domain whether they
work for a central or local government organisation, and whether they
will need to sign the MOU or agreement in order to go live. So this
commit creates a structure to store this information.
2018-02-26 08:53:46 +00:00
Chris Hill-Scott
156625a994 Remove raw string notation
Makes it fiddlier to add new domains, and is only needed to generate the
regular expression. Much cleaner to just insert them as part of
generating the regular expression.
2018-02-26 08:53:46 +00:00
Chris Hill-Scott
3e79ae1bfe Encapsulate domain list in class
Code shouldn’t be accessing this list directly; the class should provide
a sensible interface to the data.
2018-02-26 08:53:46 +00:00
Chris Hill-Scott
7c339b808e Refactor logic around gov domains into a class
This gives us space to add more logic in the future, and expose more
information than whether a given domain is/isn’t government.
2018-02-26 08:53:45 +00:00
Chris Hill-Scott
96aac519cc Extend user client to count users with permission
One of the things we need to know for a service to go live is whether
they have at least two users with the ‘manage service’ permission.

So this commit adds a method to the client to count how many users have
a given permission. We can do logic on this count later. But having the
counting done in the client feels like a cleaner separation of concerns.

Meant some refactoring of the way `service_id` is extracted from the
request, in order to make it easier to mock.
2018-02-26 08:53:45 +00:00
Chris Hill-Scott
56833b1d10 Add test for existing get users client method
Want to make sure it’s doing what I expect before I build another method
that calls through to it.
2018-02-26 08:53:45 +00:00
Chris Hill-Scott
51f0320aec Add API client method to count templates
When users request to go live we check stuff like:
- if they’ve added templates
- if they have email templates (then we can check their reply to
  address)

This commit adds a method to do this programatically rather than
manually.

We _could_ do this in SQL, but for page that’s used intermittently it
doesn’t feel worth the work/optimisation (and the client method is at
least in place now if we do ever need to lean on this code more
heavily).
2018-02-26 08:53:45 +00:00
Chris Hill-Scott
103a36a5da Hide ‘request to go live’ from API only users
Users who have the ‘manage API keys’ permission can see the settings
page. But they don’t have permission to request to go live.

At the moment they can still see the link, though clicking it gives them
a 403 error. This commit changes it so that they can’t see the link, and
tells them who they should speak to about going live (their manager).
2018-02-26 08:53:45 +00:00
Pete Herlihy
24f6b7246d Late entry with DVSA enforcement.... 2018-02-26 08:53:45 +00:00
Pete Herlihy
6abbc4b1d6 160-165 services and 65-66 orgs
4 Pembrokeshire services and 1 new Hackney service
2018-02-26 08:53:45 +00:00