http: introduce required roles on the relevant routes
2 files changed, 7 insertions(+), 2 deletions(-)

M conftest.py
M tshistory_supervision/http.py
M conftest.py +5 -2
@@ 8,7 8,8 @@ import webtest
 from tshistory.schema import tsschema
 from tshistory import api
 from tshistory.testutil import make_tsx
-from tshistory.http import app
+from tshistory.http import app as appmaker
+from tshistory.http.util import nosecurity
 
 from tshistory_supervision.schema import supervision_schema
 from tshistory_supervision import http

          
@@ 89,7 90,9 @@ def client(engine):
         'tsh',
         {'other': (DBURI, 'other')}
     )
-    wsgi = app.make_app(tsa, http.supervision_httpapi)
+    wsgi = nosecurity(
+        appmaker.make_app(tsa, http.supervision_httpapi)
+    )
     yield WebTester(wsgi)
 
 

          
M tshistory_supervision/http.py +2 -0
@@ 21,6 21,7 @@ from tshistory.http.server import httpap
 from tshistory.http.util import (
     enum,
     onerror,
+    required_roles,
     utcdt
 )
 from tshistory.http.horizon import OPERATORS

          
@@ 72,6 73,7 @@ class supervision_httpapi(httpapi):
 
             @api.expect(edited)
             @onerror
+            @required_roles('admin', 'rw', 'ro')
             def get(self):
                 args = edited.parse_args()
                 if not tsa.exists(args.name):