Commit Graph

410 Commits

Author SHA1 Message Date
D. Berge
0fdb42c593 Do not import files that have just been modified.
We now check that a file is at least a few seconds old
before attempting to import it.

The actual minimum age can be configured in etc/config.yaml or
else is defaults to 10 seconds.

The idea is that this should give the OS enough time to fully
write the file before we import it.

The timestamp being looked at is the modification time.

Fixes #92.
2021-05-07 13:50:32 +02:00
D. Berge
6e5584a433 Make the QC double-tick green if all items accepted.
Closes #90.
2021-05-07 13:38:26 +02:00
D. Berge
0a4df0793d Update package dependencies 2021-05-07 13:37:44 +02:00
D. Berge
1e6cc67b05 Merge branch '63-serve-api-specification' into 'devel'
Resolve "Serve API specification"

Closes #63

See merge request wgp/dougal/software!5
2020-12-30 08:45:55 +00:00
D. Berge
3c4a558e02 Serve OpenAPI document on API root.
When a client makes a request for `/` (the root of
the API), the OpenAPI description is served in an
appropriate format according to the `Accept` request
header, as follows:

Accept: text/html => HTML version
Accept: application/json => JSON version
Accept: * => YAML version
2020-12-29 16:20:57 +01:00
D. Berge
76001cffe1 Create HTML version of OpenAPI doc on install.
When running `npm install`, a self-contained HTML document
with the contents of the OpenAPI specification is saved as
openapi.html in the same directory as openapi.yaml.
2020-12-29 16:18:53 +01:00
D. Berge
45a9c5aa07 Document login and logout endpoints 2020-10-23 17:28:41 +02:00
D. Berge
f926184471 Add label descriptions to API spec 2020-10-23 15:14:52 +02:00
D. Berge
5ffd3712cf Merge branch '61-user-authentication' into devel 2020-10-23 15:14:09 +02:00
D. Berge
80451796e1 Convert expiry time to milliseconds for set-cookie 2020-10-23 14:59:45 +02:00
D. Berge
141d5805ae Reissue user login tokens when close to expiring 2020-10-23 14:50:35 +02:00
D. Berge
250ffe243d Fix JWT token time to live.
Now half an hour.
2020-10-23 14:49:52 +02:00
D. Berge
b4decd018a Add API documentation 2020-10-23 11:09:08 +02:00
D. Berge
46d489c91f Fix metadata retrieval from preplots 2020-10-23 11:01:38 +02:00
D. Berge
8a0bcc5cb4 Change HTTP response status from 201 to 204 2020-10-23 11:00:56 +02:00
D. Berge
77258b12e9 Merge branch '62-service-desk-from-ss-om-magseisfairfield-com-bug-report' into 'devel'
Resolve "Service Desk (from ss.om@magseisfairfield.com): Bug report"

Closes #62

See merge request wgp/dougal/software!4
v1
2020-10-15 17:20:30 +00:00
D. Berge
6896d8bc87 Change sequence renumbering behaviour.
By default, change just the number of the sequence
being edited. It is checked for conflict with other
planned sequences but not with anything already acquired.

If the user ticks the ‘shift all’ checkbox, then all
planned sequences are shifted by the same amount.
2020-10-15 19:07:27 +02:00
D. Berge
80b463fbb7 Change default sequence assignment for planned lines.
If there are other lines in the planner, we increment the
highest numbered sequence in the planner by one.

If there are no planned lines, we take the highest numbered
raw sequence and increment by one.
2020-10-15 19:05:14 +02:00
D. Berge
59aaacbeee Apply access restrictions to writable routes 2020-10-12 19:43:07 +02:00
D. Berge
3c86981dc6 Add authorisation middleware.
Defines three levels of access:
* read: anyone who is logged in
* write: `user` and `admin` roles
* admin: `admin` roles
2020-10-12 19:42:02 +02:00
D. Berge
5594b6863c Do not run authentication if headers already sent 2020-10-12 19:41:00 +02:00
D. Berge
7201c29df5 Inject auth middleware after login routes.
Routes not requiring authentication must,
self-evidently, go before the authentication
middleware.
2020-10-11 22:11:36 +02:00
D. Berge
947736e8c1 Check code rather than errno.
Different versions of that library work
differently.
2020-10-11 22:10:21 +02:00
D. Berge
d782a30e90 Avoid decoding empty cookies 2020-10-11 19:59:28 +02:00
D. Berge
987dbb7700 Handle null/invalid cookies 2020-10-11 19:36:11 +02:00
D. Berge
cdd007ce88 Fix authentification middleware 2020-10-11 19:08:36 +02:00
D. Berge
a38066ec82 Set cookie / user to null if failing to decode JWT 2020-10-11 19:06:57 +02:00
D. Berge
2aca34e488 Read user login info from discrete file.
`$DOUGAL_ROOT/etc/users.yaml` to be exact.
2020-10-11 18:21:19 +02:00
D. Berge
324306a77d Remove logging statement 2020-10-11 18:20:41 +02:00
D. Berge
ab8a66bdcf Set JWT default options 2020-10-11 17:58:41 +02:00
D. Berge
b3f393a6f1 Make navigation bar user control functional.
Shows whether the user is logged in and presents
appropriate options according to whether this is
a manual or automatic login (a manual login is
when the user explicitly logs in with a user name
and password).
2020-10-11 17:57:00 +02:00
D. Berge
1ee886db63 Add login/logout views to frontend 2020-10-11 17:56:32 +02:00
D. Berge
fc9450434c Read credentials from cookie store when loading app 2020-10-11 17:55:17 +02:00
D. Berge
00f4fcf292 Read credentials from API responses 2020-10-11 17:54:34 +02:00
D. Berge
0512ac2c3c Add user module to Vuex store 2020-10-11 17:53:39 +02:00
D. Berge
dd32982cbe Add login/logout middleware 2020-10-11 17:52:13 +02:00
D. Berge
a3bfb73937 Add authentication middleware.
The user is authenticated by one of the following
methods, in order of priority:

* The presence of a valid JWT.
* Its IP.
* Its hostname.

In the case of the latter two methods, if authentication
is successful a JWT valid for 15 minutes will be generated
and passed back to the user in a cookie.
2020-10-11 13:11:43 +02:00
D. Berge
e0cd52f21a Replace favicon 2020-10-11 12:17:40 +02:00
D. Berge
d902806c32 Replace logo 2020-10-11 12:08:00 +02:00
D. Berge
f3e171264c Fix development websocket URL 2020-10-09 18:10:14 +02:00
D. Berge
6e7016e2ac Merge branch '59-planner' into 'devel'
Resolve "Planner"

Closes #59

See merge request wgp/dougal/software!2
2020-10-09 15:58:06 +00:00
D. Berge
c0e25ac36f Allow editing fsp/lsp in planner.
This is a very basic implementation and doesn't
check that the points are indeed valid.

A proper solution is to request the list of preplots
for that line from the server and validate against those.
2020-10-09 15:09:43 +02:00
D. Berge
2031922d68 Update line names when renumbering sequences 2020-10-09 15:04:45 +02:00
D. Berge
aeae758744 Let patch regenerate line name.
If the user sends a patch to a line with
a `name` which is exactly `null` or the
empty string `""`, the server will regenerate
the name based on the defaults script.
2020-10-09 15:02:31 +02:00
D. Berge
b7f65c4f78 Fix transaction handling 2020-10-09 15:01:42 +02:00
D. Berge
eb582863bb Move auxiliary functions to a separate file.
So they can be reused.
2020-10-09 15:00:01 +02:00
D. Berge
5415e81334 Avoid conflict when decrementing sequence numbers 2020-10-09 14:06:38 +02:00
D. Berge
9fd48c6a5a Show planned lines on map 2020-10-09 13:59:59 +02:00
D. Berge
851a076c06 Implement editing of most planned sequence details 2020-10-09 13:59:11 +02:00
D. Berge
72922560d2 Add GeoJSON output of planned lines 2020-10-09 13:58:11 +02:00