-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from pvarki/tak_ldap
TAK LDAP related things
- Loading branch information
Showing
13 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 1.3.1 | ||
current_version = 1.4.0 | ||
commit = False | ||
tag = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
""" RASENMAEHER integration API for TAK server """ | ||
__version__ = "1.3.1" # NOTE Use `bump2version --config-file patch` to bump versions correctly | ||
__version__ = "1.4.0" # NOTE Use `bump2version --config-file patch` to bump versions correctly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
"""Descriptions API""" | ||
from typing import Optional | ||
import logging | ||
|
||
from fastapi import APIRouter | ||
from pydantic import BaseModel, Extra, Field # pylint: disable=(no-name-in-module # false-positive | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
router = APIRouter() # These endpoints are public | ||
|
||
|
||
# FIXME: Move to libpvarki | ||
class ProductDescription(BaseModel): # pylint: disable=too-few-public-methods | ||
"""Description of a product""" | ||
|
||
shortname: str = Field(description="Short name for the product, used as slug/key in dicts and urls") | ||
title: str = Field(description="Fancy name for the product") | ||
icon: Optional[str] = Field(description="URL for icon") | ||
description: str = Field(description="Short-ish description of the product") | ||
language: str = Field(description="Language of this response") | ||
|
||
class Config: # pylint: disable=too-few-public-methods | ||
"""Pydantic configs""" | ||
|
||
extra = Extra.forbid | ||
|
||
|
||
@router.get( | ||
"/{language}", | ||
response_model=ProductDescription, | ||
) | ||
async def return_product_description(language: str) -> ProductDescription: | ||
"""Fetch description from each product in manifest""" | ||
if language == "fi": | ||
# FIXME: Localize | ||
return ProductDescription( | ||
shortname="tak", | ||
title="TAK: Team Awareness Kit", | ||
icon=None, | ||
description="Situational awareness system", | ||
language="en", | ||
) | ||
if language == "sv": | ||
# FIXME: Localize | ||
return ProductDescription( | ||
shortname="tak", | ||
title="TAK: Team Awareness Kit", | ||
icon=None, | ||
description="Situational awareness system", | ||
language="en", | ||
) | ||
# Fall back to English | ||
return ProductDescription( | ||
shortname="tak", | ||
title="TAK: Team Awareness Kit", | ||
icon=None, | ||
description="Situational awareness system", | ||
language="en", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Instructions endpoints""" | ||
from typing import Dict | ||
import logging | ||
|
||
from fastapi import APIRouter, Depends | ||
from libpvarki.middleware import MTLSHeader | ||
from libpvarki.schemas.product import UserCRUDRequest | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
router = APIRouter(dependencies=[Depends(MTLSHeader(auto_error=True))]) | ||
|
||
|
||
@router.post("/{language}") | ||
async def user_intructions(user: UserCRUDRequest) -> Dict[str, str]: | ||
"""return user instructions""" | ||
return { | ||
"callsign": user.callsign, | ||
"instructions": "FIXME: Return something sane", | ||
"language": "en", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters