Initial commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from functools import wraps
|
||||
from typing import List, Union
|
||||
|
||||
from core.utils.app_context import use_user
|
||||
|
||||
|
||||
def can(permissions: Union[str, List[str]]):
|
||||
def can_inner(func):
|
||||
@wraps(func)
|
||||
async def wrapper(*args, **kwargs):
|
||||
print(permissions)
|
||||
user = use_user()
|
||||
# raise HTTPException(status_code=403, detail='forbidden request')
|
||||
return await func(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return can_inner
|
||||
Reference in New Issue
Block a user