Add skeleton for a few decorators
This commit is contained in:
parent
869ce7a269
commit
0b2e5d00c2
1 changed files with 21 additions and 0 deletions
21
server/api/decorators.py
Normal file
21
server/api/decorators.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from functools import wraps
|
||||
from flask import session
|
||||
|
||||
def login_required(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
return f(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
def admins_only(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
return f(*args, **kwargs)
|
||||
return decorated_function
|
||||
|
||||
def check_csrf(f):
|
||||
@wraps(f)
|
||||
@login_required
|
||||
def wrapper(*args, **kwds):
|
||||
return f(*args, **kwds)
|
||||
return wrapper
|
Loading…
Reference in a new issue