Skip to content
Snippets Groups Projects
Commit 5ab1bc1c authored by istmxrein's avatar istmxrein
Browse files

update lib and add function to check access for cube id

parent 3e6e67dd
Branches
Tags
No related merge requests found
...@@ -53,3 +53,13 @@ async def verify_user(cube_id: int, x_forwarded_preferred_username: Optional[str ...@@ -53,3 +53,13 @@ async def verify_user(cube_id: int, x_forwarded_preferred_username: Optional[str
return True return True
raise HTTPException(status_code=401, detail="Unauthorized") raise HTTPException(status_code=401, detail="Unauthorized")
def verify_user_pi(cube_id: int, username: str, admin: bool):
if admin:
return True
elif username is not None and CUBE_ACCESS_LIST.get(cube_id) is not None:
if username in CUBE_ACCESS_LIST.get(cube_id):
return True
return False
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='pilab', name='pilab',
version='0.2.0', version='0.3.0',
description='Shared-Libs for the pi-lab microservices', description='Shared-Libs for the pi-lab microservices',
url='https://code.fbi.h-da.de/api/v4/projects/27896/packages/pypi/pilab', url='https://code.fbi.h-da.de/api/v4/projects/27896/packages/pypi/pilab',
author='Max Reinheimer', author='Max Reinheimer',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment