blob: edd23cb66fc237078f542efeb43d0bf93b3ecafc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
(define-module (webid-oidc server delete)
#:use-module (webid-oidc errors)
#:use-module (webid-oidc server resource path)
#:use-module (webid-oidc server resource content)
#:use-module (webid-oidc server precondition)
#:use-module (webid-oidc cache)
#:use-module (webid-oidc fetch)
#:use-module (webid-oidc http-link)
#:use-module (webid-oidc server resource wac)
#:use-module ((webid-oidc stubs) #:prefix stubs:)
#:use-module (webid-oidc rdf-index)
#:use-module ((webid-oidc refresh-token) #:prefix refresh:)
#:use-module (web uri)
#:use-module (web client)
#:use-module (web response)
#:use-module (rdf rdf)
#:use-module (turtle tordf)
#:use-module (turtle fromrdf)
#:use-module (rnrs bytevectors)
#:use-module (ice-9 exceptions)
#:use-module (ice-9 receive)
#:use-module (ice-9 optargs)
#:use-module (ice-9 iconv)
#:use-module (ice-9 textual-ports)
#:use-module (ice-9 binary-ports)
#:use-module (ice-9 threads)
#:use-module (ice-9 hash-table)
#:use-module (rnrs bytevectors)
#:use-module (oop goops)
#:export
(
delete
))
(define* (delete server-name owner user path if-match if-none-match
#:key
(http-get http-get))
(check-acl-can-write server-name path owner user)
(with-session
(lambda (load-content-type load-contained load-static-content
do-create do-delete)
(receive (base-path path-type)
(base-path path)
(update-path
base-path
(lambda (main-etag auxiliary)
(let ((relevant-etag
(if path-type
(assoc-ref auxiliary path-type)
main-etag)))
(check-precondition path if-match if-none-match relevant-etag)
(if path-type
;; Delete an auxiliary resource
(values
main-etag
(filter
(lambda (auxiliary)
(not (equal? (car auxiliary) path-type)))
auxiliary))
;; Delete the main resource, if it’s not the root and
;; it’s not a non-empty container (those things are
;; checked by update-path).
#f)))
load-content-type load-contained load-static-content do-create do-delete)))))
|