Mercurial > gemma
annotate pkg/controllers/routes.go @ 827:f3adc0f3a20a
Use templating to make somewhat more interesting test notification mails.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 27 Sep 2018 23:24:40 +0200 |
parents | 8926c413db21 |
children | 0f61bfc21041 |
rev | line source |
---|---|
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package controllers |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import ( |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 "net/http" |
346
ad0e47c1fedf
Use httputil.ReverseProxy for WFS proxying.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
335
diff
changeset
|
5 "net/http/httputil" |
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
414
c1047fd04a3a
Moved project specific Go packages to new pkg folder.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
408
diff
changeset
|
7 "github.com/gorilla/mux" |
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
414
c1047fd04a3a
Moved project specific Go packages to new pkg folder.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
408
diff
changeset
|
9 "gemma.intevation.de/gemma/pkg/auth" |
419
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
10 "gemma.intevation.de/gemma/pkg/middleware" |
442
fc37e7072022
Moved some models used in controllers to to model package because they may be needed elsewhere (e.g. GeoServer config).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
441
diff
changeset
|
11 "gemma.intevation.de/gemma/pkg/models" |
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 ) |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 func BindRoutes(m *mux.Router) { |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 api := m.PathPrefix("/api").Subrouter() |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
270
d1b0d964af09
Dont restrict listing/updating of users to sys_admins.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
254
diff
changeset
|
18 var ( |
d1b0d964af09
Dont restrict listing/updating of users to sys_admins.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
254
diff
changeset
|
19 sysAdmin = auth.EnsureRole("sys_admin") |
472
39b5deee8810
Replaced 'all' by 'any' in routes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
443
diff
changeset
|
20 any = auth.EnsureRole("sys_admin", "waterway_admin", "waterway_user") |
270
d1b0d964af09
Dont restrict listing/updating of users to sys_admins.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
254
diff
changeset
|
21 ) |
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
335
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
23 // User management. |
472
39b5deee8810
Replaced 'all' by 'any' in routes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
443
diff
changeset
|
24 api.Handle("/users", any(&JSONHandler{ |
250
deabc2712634
Implemented /users GET as list of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
242
diff
changeset
|
25 Handle: listUsers, |
deabc2712634
Implemented /users GET as list of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
242
diff
changeset
|
26 })).Methods(http.MethodGet) |
deabc2712634
Implemented /users GET as list of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
242
diff
changeset
|
27 |
deabc2712634
Implemented /users GET as list of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
242
diff
changeset
|
28 api.Handle("/users", sysAdmin(&JSONHandler{ |
442
fc37e7072022
Moved some models used in controllers to to model package because they may be needed elsewhere (e.g. GeoServer config).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
441
diff
changeset
|
29 Input: func() interface{} { return new(models.User) }, |
239
713234a04a87
Renamed JSONHandler.Process to JSONHandler.Handler as it sounds more symmetrical.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
237
diff
changeset
|
30 Handle: createUser, |
237
3771788d3dae
Reduce boilerplate code when writing JSON parsing/generating endpoints.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
235
diff
changeset
|
31 })).Methods(http.MethodPost) |
3771788d3dae
Reduce boilerplate code when writing JSON parsing/generating endpoints.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
235
diff
changeset
|
32 |
472
39b5deee8810
Replaced 'all' by 'any' in routes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
443
diff
changeset
|
33 api.Handle("/users/{user}", any(&JSONHandler{ |
254
de6fdb316b8f
Implemented /users/{user} GET a listing of given user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
250
diff
changeset
|
34 Handle: listUser, |
de6fdb316b8f
Implemented /users/{user} GET a listing of given user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
250
diff
changeset
|
35 })).Methods(http.MethodGet) |
de6fdb316b8f
Implemented /users/{user} GET a listing of given user.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
250
diff
changeset
|
36 |
472
39b5deee8810
Replaced 'all' by 'any' in routes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
443
diff
changeset
|
37 api.Handle("/users/{user}", any(&JSONHandler{ |
442
fc37e7072022
Moved some models used in controllers to to model package because they may be needed elsewhere (e.g. GeoServer config).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
441
diff
changeset
|
38 Input: func() interface{} { return new(models.User) }, |
239
713234a04a87
Renamed JSONHandler.Process to JSONHandler.Handler as it sounds more symmetrical.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
237
diff
changeset
|
39 Handle: updateUser, |
237
3771788d3dae
Reduce boilerplate code when writing JSON parsing/generating endpoints.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
235
diff
changeset
|
40 })).Methods(http.MethodPut) |
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
240
9012e4045da4
Implemented /user delete controller.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
239
diff
changeset
|
42 api.Handle("/users/{user}", sysAdmin(&JSONHandler{ |
9012e4045da4
Implemented /user delete controller.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
239
diff
changeset
|
43 Handle: deleteUser, |
242
24eb518b0394
/users delete should be handled by HTTP DELETE not PUT.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
240
diff
changeset
|
44 })).Methods(http.MethodDelete) |
240
9012e4045da4
Implemented /user delete controller.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
239
diff
changeset
|
45 |
822
8926c413db21
Started implementation of test mail end point.
Sascha Wilde <wilde@intevation.de>
parents:
812
diff
changeset
|
46 // System notifications |
8926c413db21
Started implementation of test mail end point.
Sascha Wilde <wilde@intevation.de>
parents:
812
diff
changeset
|
47 api.Handle("/testmail/{user}", sysAdmin(&JSONHandler{ |
8926c413db21
Started implementation of test mail end point.
Sascha Wilde <wilde@intevation.de>
parents:
812
diff
changeset
|
48 Handle: sendTestMail, |
8926c413db21
Started implementation of test mail end point.
Sascha Wilde <wilde@intevation.de>
parents:
812
diff
changeset
|
49 })).Methods(http.MethodGet) |
8926c413db21
Started implementation of test mail end point.
Sascha Wilde <wilde@intevation.de>
parents:
812
diff
changeset
|
50 |
722
815f5e2ed974
Added simple endpoint to view system logs.
Sascha Wilde <wilde@intevation.de>
parents:
710
diff
changeset
|
51 // System Management |
815f5e2ed974
Added simple endpoint to view system logs.
Sascha Wilde <wilde@intevation.de>
parents:
710
diff
changeset
|
52 api.Handle("/system/log/{service}/{file}", sysAdmin(&JSONHandler{ |
815f5e2ed974
Added simple endpoint to view system logs.
Sascha Wilde <wilde@intevation.de>
parents:
710
diff
changeset
|
53 Handle: showSystemLog, |
815f5e2ed974
Added simple endpoint to view system logs.
Sascha Wilde <wilde@intevation.de>
parents:
710
diff
changeset
|
54 NoConn: true, |
815f5e2ed974
Added simple endpoint to view system logs.
Sascha Wilde <wilde@intevation.de>
parents:
710
diff
changeset
|
55 })).Methods(http.MethodGet) |
815f5e2ed974
Added simple endpoint to view system logs.
Sascha Wilde <wilde@intevation.de>
parents:
710
diff
changeset
|
56 |
335
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
57 // Password resets. |
302
0777aa6de45b
Password reset. Part I
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
281
diff
changeset
|
58 api.Handle("/users/passwordreset", &JSONHandler{ |
442
fc37e7072022
Moved some models used in controllers to to model package because they may be needed elsewhere (e.g. GeoServer config).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
441
diff
changeset
|
59 Input: func() interface{} { return new(models.PWResetUser) }, |
304
69e291f26bbd
Password reset: Part II.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
302
diff
changeset
|
60 Handle: passwordResetRequest, |
710
3e9f0070c33e
Password reset endpoints do not need impersonated db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
61 NoConn: true, |
304
69e291f26bbd
Password reset: Part II.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
302
diff
changeset
|
62 }).Methods(http.MethodPost) |
69e291f26bbd
Password reset: Part II.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
302
diff
changeset
|
63 |
69e291f26bbd
Password reset: Part II.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
302
diff
changeset
|
64 api.Handle("/users/passwordreset/{hash}", &JSONHandler{ |
302
0777aa6de45b
Password reset. Part I
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
281
diff
changeset
|
65 Handle: passwordReset, |
710
3e9f0070c33e
Password reset endpoints do not need impersonated db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
66 NoConn: true, |
304
69e291f26bbd
Password reset: Part II.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
302
diff
changeset
|
67 }).Methods(http.MethodGet) |
302
0777aa6de45b
Password reset. Part I
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
281
diff
changeset
|
68 |
426
4a03d000c854
Fixed wrong comments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
421
diff
changeset
|
69 // External proxies. |
443
5e8ac1c67fe6
Even the usage of the external proxied WFS/WMS need to logged into gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
442
diff
changeset
|
70 external := &httputil.ReverseProxy{ |
442
fc37e7072022
Moved some models used in controllers to to model package because they may be needed elsewhere (e.g. GeoServer config).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
441
diff
changeset
|
71 Director: proxyDirector(models.ExternalServices.Find), |
421
c37457f12b8e
Differ between internal and external proxies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
419
diff
changeset
|
72 ModifyResponse: proxyModifyResponse("/api/external/"), |
346
ad0e47c1fedf
Use httputil.ReverseProxy for WFS proxying.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
335
diff
changeset
|
73 } |
ad0e47c1fedf
Use httputil.ReverseProxy for WFS proxying.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
335
diff
changeset
|
74 |
472
39b5deee8810
Replaced 'all' by 'any' in routes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
443
diff
changeset
|
75 externalAuth := any(external) |
443
5e8ac1c67fe6
Even the usage of the external proxied WFS/WMS need to logged into gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
442
diff
changeset
|
76 |
5e8ac1c67fe6
Even the usage of the external proxied WFS/WMS need to logged into gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
442
diff
changeset
|
77 api.Handle("/external/{hash}/{url}", externalAuth). |
408
ac23905e64b1
Improve WFS proxy a lot. It now generates signed re-writings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
359
diff
changeset
|
78 Methods( |
ac23905e64b1
Improve WFS proxy a lot. It now generates signed re-writings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
359
diff
changeset
|
79 http.MethodGet, http.MethodPost, |
ac23905e64b1
Improve WFS proxy a lot. It now generates signed re-writings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
359
diff
changeset
|
80 http.MethodPut, http.MethodDelete) |
ac23905e64b1
Improve WFS proxy a lot. It now generates signed re-writings.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
359
diff
changeset
|
81 |
443
5e8ac1c67fe6
Even the usage of the external proxied WFS/WMS need to logged into gemma.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
442
diff
changeset
|
82 api.Handle("/external/{entry}", externalAuth). |
335
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
83 Methods( |
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
84 http.MethodGet, http.MethodPost, |
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
85 http.MethodPut, http.MethodDelete) |
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
86 |
426
4a03d000c854
Fixed wrong comments.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
421
diff
changeset
|
87 // Internal proxies. |
419
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
88 internal := &httputil.ReverseProxy{ |
474
11d80120ed3d
Renamed published services to internal services to be more symmetrical to external services.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
473
diff
changeset
|
89 Director: proxyDirector(models.InternalServices.Find), |
421
c37457f12b8e
Differ between internal and external proxies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
419
diff
changeset
|
90 ModifyResponse: proxyModifyResponse("/api/internal/"), |
419
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
91 } |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
92 |
472
39b5deee8810
Replaced 'all' by 'any' in routes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
443
diff
changeset
|
93 internalAuth := any( |
419
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
94 middleware.ModifyQuery(internal, middleware.InjectUser)) |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
95 |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
96 api.Handle("/internal/{hash}/{url}", internalAuth). |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
97 Methods( |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
98 http.MethodGet, http.MethodPost, |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
99 http.MethodPut, http.MethodDelete) |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
100 |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
101 api.Handle("/internal/{entry}", internalAuth). |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
102 Methods( |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
103 http.MethodGet, http.MethodPost, |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
104 http.MethodPut, http.MethodDelete) |
6627c48363a0
First attempt for user injection of proxy for using GeoServer with role based security.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
414
diff
changeset
|
105 |
473
b2dea4e56ff1
/api/published (GET) returns a JSON document of the geo-services published by the gemma server.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
472
diff
changeset
|
106 api.Handle("/published", any(&JSONHandler{ |
b2dea4e56ff1
/api/published (GET) returns a JSON document of the geo-services published by the gemma server.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
472
diff
changeset
|
107 Handle: published, |
486
b2dc9c2f69e0
First stab to use the metamorphic db to do all database stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
484
diff
changeset
|
108 NoConn: true, |
473
b2dea4e56ff1
/api/published (GET) returns a JSON document of the geo-services published by the gemma server.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
472
diff
changeset
|
109 })).Methods(http.MethodGet) |
b2dea4e56ff1
/api/published (GET) returns a JSON document of the geo-services published by the gemma server.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
472
diff
changeset
|
110 |
812
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
801
diff
changeset
|
111 // Bottleneck selection |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
801
diff
changeset
|
112 api.Handle("/surveys/{bottleneck}", any(&JSONHandler{ |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
801
diff
changeset
|
113 Handle: listSurveys, |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
801
diff
changeset
|
114 })).Methods(http.MethodGet) |
98a7776100fb
Added end point lo list available surveys for a given bottleneck.
Sascha Wilde <wilde@intevation.de>
parents:
801
diff
changeset
|
115 |
633
6093016fac88
Cross sections: started with implementation of web service (WIP).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
486
diff
changeset
|
116 // Cross sections |
6093016fac88
Cross sections: started with implementation of web service (WIP).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
486
diff
changeset
|
117 |
642
e95df6657023
Cross sections: call web endpoint simply 'cross' instead of 'cross-section'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
633
diff
changeset
|
118 api.Handle("/cross", any(&JSONHandler{ |
633
6093016fac88
Cross sections: started with implementation of web service (WIP).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
486
diff
changeset
|
119 Input: func() interface{} { return new(models.CrossSectionInput) }, |
6093016fac88
Cross sections: started with implementation of web service (WIP).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
486
diff
changeset
|
120 Handle: crossSection, |
6093016fac88
Cross sections: started with implementation of web service (WIP).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
486
diff
changeset
|
121 })).Methods(http.MethodPost) |
6093016fac88
Cross sections: started with implementation of web service (WIP).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
486
diff
changeset
|
122 |
743
fdff2de616ad
Added search function for river kilometer.
Sascha Wilde <wilde@intevation.de>
parents:
722
diff
changeset
|
123 // Feature search |
fdff2de616ad
Added search function for river kilometer.
Sascha Wilde <wilde@intevation.de>
parents:
722
diff
changeset
|
124 api.Handle("/search", any(&JSONHandler{ |
fdff2de616ad
Added search function for river kilometer.
Sascha Wilde <wilde@intevation.de>
parents:
722
diff
changeset
|
125 Input: func() interface{} { return new(models.SearchRequest) }, |
fdff2de616ad
Added search function for river kilometer.
Sascha Wilde <wilde@intevation.de>
parents:
722
diff
changeset
|
126 Handle: searchFeature, |
fdff2de616ad
Added search function for river kilometer.
Sascha Wilde <wilde@intevation.de>
parents:
722
diff
changeset
|
127 })).Methods(http.MethodPost) |
fdff2de616ad
Added search function for river kilometer.
Sascha Wilde <wilde@intevation.de>
parents:
722
diff
changeset
|
128 |
335
bd292a554b6e
Made gemma a WFS proxy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
304
diff
changeset
|
129 // Token handling: Login/Logout. |
231
694f959ba3e7
Fixed bad route to /logout controller.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
226
diff
changeset
|
130 api.HandleFunc("/login", login). |
484
2ac37419f593
Implemented wamos/issue114 (Improve code consistency: For login use json body, disallow GET).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
474
diff
changeset
|
131 Methods(http.MethodPost) |
231
694f959ba3e7
Fixed bad route to /logout controller.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
226
diff
changeset
|
132 api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(logout))). |
226
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 Methods(http.MethodGet, http.MethodPost) |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 api.Handle("/renew", auth.SessionMiddleware(http.HandlerFunc(renew))). |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 Methods(http.MethodGet, http.MethodPost) |
63dd5216eee4
Refactored gemma server to be more REST-like.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 } |