Mercurial > gemma
comparison pkg/controllers/routes.go @ 978:544a5cfe07cd
Started with endpoint for uploading sounding result and trigger respective import job.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 18 Oct 2018 18:37:19 +0200 |
parents | b882b2c796c1 |
children | a244b18cb916 |
comparison
equal
deleted
inserted
replaced
977:4a2ca0e20006 | 978:544a5cfe07cd |
---|---|
14 func BindRoutes(m *mux.Router) { | 14 func BindRoutes(m *mux.Router) { |
15 | 15 |
16 api := m.PathPrefix("/api").Subrouter() | 16 api := m.PathPrefix("/api").Subrouter() |
17 | 17 |
18 var ( | 18 var ( |
19 sysAdmin = auth.EnsureRole("sys_admin") | 19 sysAdmin = auth.EnsureRole("sys_admin") |
20 any = auth.EnsureRole("sys_admin", "waterway_admin", "waterway_user") | 20 waterwayAdmin = auth.EnsureRole("waterway_admin") |
21 any = auth.EnsureRole("sys_admin", "waterway_admin", "waterway_user") | |
21 ) | 22 ) |
22 | 23 |
23 // User management. | 24 // User management. |
24 api.Handle("/users", any(&JSONHandler{ | 25 api.Handle("/users", any(&JSONHandler{ |
25 Handle: listUsers, | 26 Handle: listUsers, |
137 | 138 |
138 // Geo styling | 139 // Geo styling |
139 api.Handle("/geo/style/{feature}", | 140 api.Handle("/geo/style/{feature}", |
140 sysAdmin(http.HandlerFunc(uploadStyle))).Methods(http.MethodPost) | 141 sysAdmin(http.HandlerFunc(uploadStyle))).Methods(http.MethodPost) |
141 | 142 |
143 // Imports | |
144 api.Handle("/imports/soundingresult", | |
145 waterwayAdmin(http.HandlerFunc(importSoundingResult))).Methods(http.MethodPost) | |
146 | |
142 // Token handling: Login/Logout. | 147 // Token handling: Login/Logout. |
143 api.HandleFunc("/login", login). | 148 api.HandleFunc("/login", login). |
144 Methods(http.MethodPost) | 149 Methods(http.MethodPost) |
145 api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(logout))). | 150 api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(logout))). |
146 Methods(http.MethodGet, http.MethodPost) | 151 Methods(http.MethodGet, http.MethodPost) |