19 lines
474 B
Python
19 lines
474 B
Python
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
|