package caldav

  1. Overview
  2. Docs

Source file webdav_config.ml

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
type config = {
  principals : string ;
  calendars : string ;
  host : Uri.t ;
  do_trust_on_first_use : bool ;
}

let admin_acl config = [
  (`Href (Uri.of_string @@ "/" ^ config.principals ^ "/root/"), `Grant [ `All ]) ;
  (`All, `Grant [ `Read ])
]

let calendars_acl config = [
  (`Href (Uri.of_string @@ "/" ^ config.principals ^ "/root/"), `Grant [ `All ]) ;
  (`All, `Grant [ `Read ; `Bind ; `Unbind ])
]

let host ?(scheme = "http") ?(port = 8080) ?(hostname = "127.0.0.1") () =
  (* strip port if default for scheme, this should be handled by the Uri library *)
  let port = match scheme, port with
    | "http", 80 -> None
    | "https", 443 -> None
    | _ -> Some port
  in
  Uri.make ?port ~scheme ~host:hostname ()

let config
    ?(principals = "principals")
    ?(calendars = "calendars")
    ?(do_trust_on_first_use = false)
    host =
  { principals ;
    calendars ;
    do_trust_on_first_use ;
    host ;
  }
OCaml

Innovation. Community. Security.