Commit Graph

7170 Commits

Author SHA1 Message Date
Chris Hill-Scott
d92ecc9237 Add human-readable form of a government domain
This makes it easier to write a good message in the request to go live
submission. And encapsulating it in the `GovernmentDomain` class keeps
the view nice and clean.
2018-03-08 16:50:18 +00:00
Chris Hill-Scott
ce704a979d Add what we know of agreements to go live request
When we process a go live request it’s a pain to have to go fishing in
the Google Drive to see if there’s a signed agreement in there. This
should make it easier when we know there’s already an agreement.
2018-03-08 16:48:43 +00:00
Chris Hill-Scott
57a77318c9 Merge pull request #1939 from alphagov/ons-no-on
Add alternative ONS domain
2018-03-08 16:10:20 +00:00
kentsanggds
d11fafdf0d Merge pull request #1926 from alphagov/ken-remove-link-from-preview-precompiled
Remove link from preview precompiled view and dashboard
2018-03-08 15:28:47 +00:00
Chris Hill-Scott
b0278c5649 Refactor to put user logic inside class 2018-03-08 15:26:55 +00:00
chrisw
a4a3472191 add catch for http error on invite token check 2018-03-08 14:36:31 +00:00
Chris Hill-Scott
f6f5faa361 Bring in refactored CSV processing
Shouldn’t be any functional changes here, just things being named more
clearly.
2018-03-08 13:30:20 +00:00
Chris Hill-Scott
59fd55432c Add alternative ONS domain 2018-03-08 12:59:37 +00:00
kentsanggds
2e170a00ba Merge pull request #1938 from alphagov/letter_preview_use_api_not_template_preview
Letter preview use api not template preview
2018-03-08 12:57:50 +00:00
Ken Tsang
8857b4ab80 Fix preview image location 2018-03-08 12:35:35 +00:00
Ken Tsang
4628b99445 Refactor to move preview logic to API
* Moved the notifications code to go to admin to get the the template

preview document rather than go to template preview.

This will remove the logic from admin and place it in api so it is
easier to expand on later when there are precompiled PDFs

* Added some error handling if API returns an API error.

Caught the error and displayed an error PNG so it is obvious something
failed. Currently it displayed a thumbnail of a png over the top of the
loading page, and therefore it wasn't obvious of the state.
2018-03-08 12:25:07 +00:00
Chris Hill-Scott
99ff30d3b3 Fix typo 2018-03-08 10:30:57 +00:00
Ken Tsang
1d5f8ce15e Remove template link from precompiled letters from dashboard 2018-03-07 23:13:36 +00:00
Ken Tsang
bcf86239c6 Remove template link from preview for precompiled letters 2018-03-07 23:13:36 +00:00
Chris Hill-Scott
61b8c9040a Merge pull request #1933 from alphagov/fix-letter-borders
Fix border around letter images
2018-03-07 16:28:46 +00:00
Chris Hill-Scott
b8373329e9 Merge pull request #1935 from alphagov/public-sector-pricing
Updated the pricing page to reflect public sector pricing
2018-03-07 16:28:38 +00:00
Chris Hill-Scott
9ed5ba165b Merge pull request #1919 from thomchambers/patch-4
Update Pricing content
2018-03-07 16:28:31 +00:00
Chris Hill-Scott
3811e87165 Merge pull request #1920 from thomchambers/patch-5
Update Using Notify content
2018-03-07 16:28:24 +00:00
Chris Hill-Scott
8aebe4f717 Merge pull request #1928 from alphagov/pyup-update-freezegun-0.3.9-to-0.3.10
Update freezegun to 0.3.10
2018-03-07 16:27:18 +00:00
Chris Hill-Scott
ebc6772869 Merge pull request #1927 from alphagov/pyup-update-pytest-3.4.1-to-3.4.2
Update pytest to 3.4.2
2018-03-07 16:27:10 +00:00
Pete Herlihy
2c675a3746 Updated the pricing page to reflect public sector pricing 2018-03-07 15:15:21 +00:00
chrisw
e32cb5df31 update organisation name 2018-03-06 17:28:04 +00:00
Chris Hill-Scott
6d3da2d91f Merge pull request #1924 from alphagov/pyup-update-coveralls-1.2.0-to-1.3.0
Update coveralls to 1.3.0
2018-03-06 16:11:54 +00:00
Chris Hill-Scott
152b1f5256 Fix border around letter images
Things in CSS stack top to bottom like this:
- image
- `box-shadow`
- `background`

We are drawing the border around the letter using `box-shadow`. This was
working fine because the images of our letters had a transparent
background, so you could see the border through them.

At some point our letters have changed to have a white background. So
you can no longer see the border.

This commit:
- adds a new pseudo element which stacks above the image of the letter
- moves the border from the image itself to said pseudo element
2018-03-06 15:50:56 +00:00
Chris Hill-Scott
dde4191e9f Merge pull request #1932 from alphagov/commas-in-columns
Prevent cells containing commas breaking downloads
2018-03-06 15:36:37 +00:00
Chris Hill-Scott
35f523c957 Prevent cells containing commas breaking downloads
If a cell in the original file contains a comma, it comes back as two
cells in the downloaded file.

The CSV writer has logic to deal with this. It seems to work a lot
better that just concatenating the columns with commas ourselves.
2018-03-06 15:11:59 +00:00
Chris Hill-Scott
8f40574c83 Merge pull request #1930 from alphagov/revert-1918-letter_preview_use_api_not_template_preview
Revert "Letter preview use api not template preview"
2018-03-06 14:28:13 +00:00
Chris Hill-Scott
4384c1df15 Merge pull request #1929 from alphagov/show-download-letters
Show CSV download link for letter jobs
2018-03-06 14:28:00 +00:00
Chris Hill-Scott
d90cdc1f81 Don’t change colour of sent date for letters
For text messages/emails it makes sense for ‘sending’ to be gray and
‘delivered’ to be black. But since we don’t show sending/delivered for
letters it doesn’t make sense for the text to change colour.
2018-03-06 13:51:50 +00:00
Rebecca Law
bc731ec54d Revert "Letter preview use api not template preview" 2018-03-06 13:47:43 +00:00
Leo Hemsted
92b4cee033 Merge pull request #1917 from alphagov/permissions-refactor
Permissions refactor
2018-03-06 13:21:17 +00:00
Leo Hemsted
3be4b57bbd fix imports 2018-03-06 13:10:37 +00:00
Leo Hemsted
793d79c242 ensure invited user permissions show up correctly 2018-03-06 13:08:07 +00:00
Leo Hemsted
7f268c0ab3 don't allow us to create permissions decorator without permissions
ie: not for an organisation, and not for a service
2018-03-06 13:08:07 +00:00
Leo Hemsted
d14f33ea70 has_permissions() now checks user's orgs for <org_id> view args
view args are parameters within the route. for example,
`/organisation/<org_id>/users`. If there is an org_id, then check that
the user is part of that organisation (users.organisations is a list of
all orgs that user is a member of).

* platform admins ignore this check if restrict_admin_usage=False
* if an endpoint has both org_id and service_id, org_id takes
  precedence, but we should probably revisit this if we ever need
  to create such an endpoint.
* you now call `@user_has_permissions()` with no arguments for
  organisation endpoints - we can look at this if we decide we want
  more clarity.
* you should never call user_has_permissions without any arguments
  for endpoints that aren't organisation-based. We'll raise
  NotImplementedError if you do.
2018-03-06 13:08:07 +00:00
Leo Hemsted
3d589887ce remove useless properties from user model
we don't need them to mask private variables if we're not doing anything unusual.
2018-03-06 13:08:07 +00:00
Leo Hemsted
8acf5115d5 add restrict_admin_usage flag to more of the send flow 2018-03-06 13:08:07 +00:00
Leo Hemsted
3afc193624 remove any_ from has_permissions
we branch on any_ to either say "require ALL these permissions" or
"require ANY of these permissions". But we only ever call the decorator
with one permission, or with any_=True, so it's unnecessary
2018-03-06 13:08:07 +00:00
Leo Hemsted
4a08cf81e7 remove admin_override from all has_permissions usage
as previously pointed out, it's not used anywhere.
2018-03-06 13:08:07 +00:00
Leo Hemsted
3ae815528c add restrict_admin_usage arg to admin_override
rather than allow admins to do everything specifically, we should
only block them from things we conciously don't want them to do.
This is "Don't let platform admins send letters from services they're
not in". Everything else the platform admins can do.

This is step one, adding a restrict_admin_usage flag, and setting that
for those restricted endpoints around creating api keys, uploading CSVs
and sending one-off messages.

Also, this commit separates the two use cases for permissions:
* user.has_permission for access control
* user.has_permission_for_service for user info - this is used for
  showing checkboxes on the manage-users page for example

With this, we can remove the admin_override flag from the permission
decorator.
2018-03-06 13:08:06 +00:00
Leo Hemsted
09824078dd remove all instances of db style permissions
lots of renaming of send_texts/emails/letters to send_messages, and
manage_settings/users to manage_service
2018-03-06 13:08:06 +00:00
Leo Hemsted
17061e0d06 map roles and db permissions
in the db, we have several rows for single permissions - we separate
`send_messages` into `send_texts`, `send_emails` and `send_letters`,
and also `manage_service` into `manage_users` and `manage_settings`.

But on the front end we don't do anything with this distinction. It's
unhelpful for us to have to think about permissions as groups of things
when we can never split them up at all. So we should combine them. This
commit makes sure:
* when user models are read  (from JSON direct from the API), we
  should transform them from db permissions into roles.
* when permissions are persisted (editing permissions, and creating
  invites), we should send db permissions to the API.

All other interaction with permissions (should just be the endpoint
decorator and checks in html templates generally) should use admin
roles.
2018-03-06 13:08:06 +00:00
Leo Hemsted
bd54dbb40c remove unnecessary invocations of has_permissions(..., any_=True)
when added to a service, all users are given the view_activity
permission. So, if that's included in the list, we don't need `any_`,
and we don't need any of the other permissions.
2018-03-06 13:08:06 +00:00
Leo Hemsted
7ddad7c99e dont use has_permissions to check for platform admins
platform_admin is a separate concept to permissions, so by removing the
checks for it from the current_user.has_permissions function, we can
simplify things greatly. We already record on the user whether they're
a platform admin anyway.
2018-03-06 13:08:06 +00:00
Chris Hill-Scott
4b69e1003e Merge pull request #1923 from alphagov/remove-dvla
Remove anything to do with DVLA format letters
2018-03-06 13:00:35 +00:00
Chris Hill-Scott
5a68fb640f Show CSV download link for letter jobs 2018-03-06 10:24:01 +00:00
pyup-bot
6d4b98ee4b Update freezegun from 0.3.9 to 0.3.10 2018-03-06 03:10:31 +00:00
pyup-bot
45b8c59d72 Update pytest from 3.4.1 to 3.4.2 2018-03-06 00:06:32 +00:00
kentsanggds
acf7b331ad Merge pull request #1918 from alphagov/letter_preview_use_api_not_template_preview
Letter preview use api not template preview
2018-03-05 16:21:12 +00:00
pyup-bot
19d2fb5962 Update coveralls from 1.2.0 to 1.3.0 2018-03-02 23:59:30 +00:00