slight adjustments to prepare the authentification validation
This commit is contained in:
parent
c5df95625d
commit
56628a3c45
@ -14,7 +14,16 @@ bp = Blueprint('shipcalls', __name__)
|
|||||||
@auth_guard() # no restriction by role
|
@auth_guard() # no restriction by role
|
||||||
def GetShipcalls():
|
def GetShipcalls():
|
||||||
if 'Authorization' in request.headers:
|
if 'Authorization' in request.headers:
|
||||||
token = request.headers.get('Authorization')
|
token = request.headers.get('Authorization') # see impl/login to see the token encoding, which is a JWT token.
|
||||||
|
|
||||||
|
"""
|
||||||
|
from BreCal.services.jwt_handler import decode_jwt
|
||||||
|
jwt = token.split('Bearer ')[1] # string key
|
||||||
|
payload = decode_jwt(jwt) # dictionary, which includes 'id' (user id) and 'participant_id'
|
||||||
|
|
||||||
|
# oneline:
|
||||||
|
payload = decode_jwt(request.headers.get("Authorization").split("Bearer ")[-1])
|
||||||
|
"""
|
||||||
options = {}
|
options = {}
|
||||||
options["participant_id"] = request.args.get("participant_id")
|
options["participant_id"] = request.args.get("participant_id")
|
||||||
options["past_days"] = request.args.get("past_days", default=1, type=int)
|
options["past_days"] = request.args.get("past_days", default=1, type=int)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from enum import Enum, IntFlag
|
from enum import IntEnum, Enum, IntFlag
|
||||||
|
|
||||||
class ParticipantType(IntFlag):
|
class ParticipantType(IntFlag):
|
||||||
"""determines the type of a participant"""
|
"""determines the type of a participant"""
|
||||||
@ -36,3 +36,6 @@ class StatusFlags(Enum):
|
|||||||
YELLOW = 2
|
YELLOW = 2
|
||||||
RED = 3
|
RED = 3
|
||||||
|
|
||||||
|
class PierSide(IntEnum):
|
||||||
|
PORTSIDE = 0 # Port/Backbord
|
||||||
|
STARBOARD_SIDE = 1 # Starboard / Steuerbord
|
||||||
|
|||||||
@ -16,7 +16,7 @@ def initPool(instancePath):
|
|||||||
print (config_path)
|
print (config_path)
|
||||||
|
|
||||||
if not os.path.exists(config_path):
|
if not os.path.exists(config_path):
|
||||||
print ('cannot find ' + config_path)
|
print ('cannot find ' + os.path.abspath(config_path))
|
||||||
print("instance path", instancePath)
|
print("instance path", instancePath)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|||||||
@ -230,7 +230,7 @@ class Shipcall:
|
|||||||
tug_required: bool
|
tug_required: bool
|
||||||
pilot_required: bool
|
pilot_required: bool
|
||||||
flags: int
|
flags: int
|
||||||
pier_side: bool
|
pier_side: bool # enumerator object in database/enum/PierSide
|
||||||
bunkering: bool
|
bunkering: bool
|
||||||
replenishing_terminal: bool
|
replenishing_terminal: bool
|
||||||
replenishing_lock: bool
|
replenishing_lock: bool
|
||||||
|
|||||||
Reference in New Issue
Block a user