Implemented mock scopes in tests and fixed scopes

This commit is contained in:
0mar
2020-10-28 17:45:58 +01:00
parent 21ea4ad2b6
commit e26fa682c1
5 changed files with 68 additions and 31 deletions

View File

@@ -28,7 +28,7 @@ class SelfAPIHandler(APIHandler):
Based on the authentication info. Acts as a 'whoami' for auth tokens.
"""
@needs_scope('read:users')
@needs_scope('all')
async def get(self):
user = self.current_user
if user is None:
@@ -382,7 +382,7 @@ class UserTokenAPIHandler(APIHandler):
class UserServerAPIHandler(APIHandler):
"""Start and stop single-user servers"""
@needs_scope('user:servers')
@needs_scope('users:servers')
async def post(self, name, server_name='', subset=None):
user = self.find_user(name)
if server_name:
@@ -432,7 +432,7 @@ class UserServerAPIHandler(APIHandler):
self.set_header('Content-Type', 'text/plain')
self.set_status(status)
@needs_scope('user:servers')
@needs_scope('users:servers')
async def delete(self, name, server_name=''):
user = self.find_user(name)
options = self.get_json_body()