Commit Graph

2259 Commits

Author SHA1 Message Date
Chris Hill-Scott
6462081f71 Retitle request to go live submission page
`<h1>`s should be unique across the site. This page’s `<h1>` matches
that of the previous page (the one with the checklist).

This commit re-titles it to:
- be unique
- more accurately describe the content of the page
2018-03-13 12:02:36 +00:00
Chris Hill-Scott
a2544a4d79 Remove the MoU question from request to go live
This question was designed to make people feel like it was OK to submit
their request without getting the MoU signed. We reckoned that this was
the fastest way of getting their service live (because the MoU is the
bit that’s most likely to slow them down).

We now have a better way of telling people:
- if they’ve signed the MoU already
- or to contact us if they haven’t (which is what the majority of teams
  seem to do now)

We were never actually using the answer to this question – we were still
checking for every service whether they had it signed.

So this commit removes this now-redundant question.
2018-03-13 11:55:39 +00:00
Chris Hill-Scott
0fae94edbe Merge pull request #1952 from alphagov/no-no-permissions-banner
Replace ‘no permissions’ banner with a line on the template page
2018-03-13 09:48:54 +00:00
Chris Hill-Scott
26c91def88 Merge pull request #1950 from alphagov/reword-rtgl
Reword request to go live checklist page
2018-03-12 16:08:30 +00:00
Chris Hill-Scott
9838c3908b Add line to template page if you can’t do anything
If someone has no permissions but needs permissions the thing they’re
probably going to need is to send a message or edit a template.

The place they will probably come to is the place where the buttons
would be – users with these permissions are finding the thing they need
to do on this page.

So this commit adds a line to this page which (hopefully) makes it clear
they’re in the right place, but need to go and speak to someone.
2018-03-12 16:02:33 +00:00
Rebecca Law
3a604ff7d8 Merge pull request #1949 from alphagov/fix-inbound-search
Fix bug with inbound message page
2018-03-12 13:32:41 +00:00
Rebecca Law
26866f441e Add asset in test 2018-03-12 13:28:20 +00:00
Chris Hill-Scott
de7701d407 Reword request to go live checklist page
Implements Thom’s suggestions.
2018-03-12 13:17:55 +00:00
kentsanggds
0d4bed1e55 Merge pull request #1946 from alphagov/ken-show-provided-as-pdf-for-precompiled-letters
Set template subject to Provided as PDF for precompiled letters
2018-03-12 10:47:05 +00:00
Chris Waszczuk
4b929aaa6c Merge pull request #1934 from alphagov/update-service-name
Update Organisation Name
2018-03-12 10:13:57 +00:00
Chris Hill-Scott
548ece6c22 Merge pull request #1925 from alphagov/refactored-csv-processing
Bring in refactored CSV processing
2018-03-09 15:16:37 +00:00
Chris Hill-Scott
7609ad3f8c Filter empty items out of lists
The email template does this already when formatting the body of the
message. But the spreadsheet preview doesn’t, which means you get lists
like:
- thing
- thing
- None

This commit fixes that.

This was a pre-existing bug, but gonna roll it in with this PR.
2018-03-09 15:13:21 +00:00
Richard Chapman
86a474ce8b Moved the call to retrieve the pdf into the is_precompiled_letter block
as it did not need to be called for standard letters.

Changed the tests to use the mock from get_notification_letter_preview
instead of a generic NotificationApiClient.get. This will hopefully
protect any subsequent changes or calls from not being tested in future.
2018-03-09 13:30:16 +00:00
Richard Chapman
e25c6cd3b9 Updated so that a precompiled pdf page count can be passed to the
rendering template. Currently it uses the template from the API to
calculate this which for a precompiled template is always 1.

Gets the PDF and then uses the utils method to get the page count.

* Added logic for precompiled letters
* Added test to test the new path
* Updated existing tests now the path has changed
2018-03-09 13:30:16 +00:00
Ken Tsang
89a04aa6a0 Set template subject to Provided as PDF for precompiled letters
- easier to change the text in Admin rather than do a database update on API and should be easy to change if the text should change in the future
2018-03-09 12:32:36 +00:00
Leo Hemsted
60a79131e6 Merge pull request #1941 from alphagov/rtgl-org-info
Add what we know of agreements to go live request
2018-03-09 12:20:57 +00:00
Chris Hill-Scott
240f11e715 Fix count of users on request to go live
We were counting users who had the `manage_settings` permission. This
is the old name for it, therefore there would never be any users with
this permission, so the tick would never go green.

The new name for the permission is `manage_service`. This commit fixes
the error, and adds an extra safeguard against something like this
happening again.
2018-03-09 10:52:13 +00:00
Chris Hill-Scott
6e869bfdef Merge pull request #1909 from alphagov/request-to-go-live-automation
Add a checklist to the request to go live page
2018-03-09 09:51:27 +00:00
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
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
chrisw
a4a3472191 add catch for http error on invite token check 2018-03-08 14:36:31 +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
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
chrisw
e32cb5df31 update organisation name 2018-03-06 17:28:04 +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
Rebecca Law
bc731ec54d Revert "Letter preview use api not template preview" 2018-03-06 13:47:43 +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
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
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
Rebecca Law
5c26d7a061 Merge pull request #1922 from alphagov/update-free-allowance-for-org-type
Update the free allowance when the organisation type is changed
2018-03-02 15:37:13 +00:00
Rebecca Law
dcb3b84468 Fix syntax error 2018-03-02 15:16:33 +00:00
Rebecca Law
f7e1ca29fe Added an assert for the mocker 2018-03-02 15:09:07 +00:00
Chris Hill-Scott
1391f12239 Remove anything to do with DVLA format letters 2018-03-02 14:30:45 +00:00
Chris Hill-Scott
1cfcb42606 Merge pull request #1921 from alphagov/duplicate-cols-error
Catch duplicate recipient columns in spreadsheets
2018-03-02 14:25:34 +00:00
Chris Hill-Scott
a4424e999f Catch duplicate recipient columns in spreadsheets
If someone has duplicate recipient columns in their file we don’t know
which one to use. This commit adds an error message which should help
them fix the duplication.

This commit doesn’t go to the extra effort to actually show the
correct values for duplication in the preview. Don’t think it’s worth
the effort/complexity for how infrequently we’ve seen this error.

Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/376
2018-03-02 13:18:04 +00:00
Alexey Bezhan
982ea8a7fa Merge pull request #1851 from alphagov/direct-api-requests-to-paas
Add route secret key header to the API requests
2018-03-02 13:17:57 +00:00
Chris Hill-Scott
ea94d466b6 Merge pull request #1911 from alphagov/fix-date-exception
Catch exceptions caused by ambiguous Excel files
2018-03-02 12:46:26 +00:00