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
|
package main
import (
"encoding/json"
"net/http"
)
type PimInspectView struct {
User *LoggedUser
Debug string
}
func handlePimInspect(w http.ResponseWriter, r *http.Request) {
user := RequireUserHtml(w, r)
if user == nil {
return
}
pim_ctl, err := NewPimBuilder(user).CheckCryptoRoot().CheckBucket().Build()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
pim_json, err := json.MarshalIndent(pim_ctl, "", " ")
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
view := PimInspectView {
User: user,
Debug: string(pim_json),
}
tKey := getTemplate("pim_inspect.html")
tKey.Execute(w, view)
}
func handlePimSetup(w http.ResponseWriter, r *http.Request) {
user := RequireUserHtml(w, r)
if user == nil {
return
}
_, err := NewPimBuilder(user).CheckCryptoRoot().CheckBucket().LdapUpdate().Build()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
user.Capabilities.CanUseEmail = true
http.Redirect(w, r, "/pim/inspect", http.StatusFound)
}
|