Skip to content

Commit

Permalink
Merge pull request #107 from DNO-inc/bodya
Browse files Browse the repository at this point in the history
version 0.7.1
  • Loading branch information
m-o-d-e-r authored Jul 31, 2023
2 parents 0c99053 + e7deef9 commit d394d9d
Show file tree
Hide file tree
Showing 18 changed files with 341 additions and 334 deletions.
620 changes: 313 additions & 307 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion burrito/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0 indev"
__version__ = "0.7.1 indev"
2 changes: 1 addition & 1 deletion burrito/apps/about/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", about_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/admin/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", admin_router)


Expand Down
8 changes: 4 additions & 4 deletions burrito/apps/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def admin__update_ticket_data(
__auth_obj: BurritoJWT = Depends(get_auth_core())
):
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"ADMIN"})

ticket: Tickets | None = is_ticket_exist(
admin_updates.ticket_id
Expand Down Expand Up @@ -152,7 +152,7 @@ async def admin__get_ticket_list_by_filter(
__auth_obj: BurritoJWT = Depends(get_auth_core())
):
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"ADMIN"})

available_filters = {
"hidden": q_is_hidden(filters.hidden),
Expand Down Expand Up @@ -204,7 +204,7 @@ async def admin__show_detail_ticket_info(
):
"""Show detail ticket info"""
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"ADMIN"})

ticket: Tickets | None = is_ticket_exist(
ticket_id_info.ticket_id
Expand All @@ -231,7 +231,7 @@ async def admin__delete_ticket(
__auth_obj: BurritoJWT = Depends(get_auth_core())
):
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"ADMIN"})

ticket: Tickets | None = is_ticket_exist(
deletion_ticket_data.ticket_id
Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/anon/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", anon_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/auth/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", auth_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/comments/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", comments_router)


Expand Down
8 changes: 4 additions & 4 deletions burrito/apps/comments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def comments__create(
__auth_obj: BurritoJWT = Depends(get_auth_core())
):
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"SEND_MESSAGE"})

ticket: Tickets | None = is_ticket_exist(creation_comment_data.ticket_id)
if ticket.hidden:
Expand Down Expand Up @@ -67,7 +67,7 @@ async def comments__edit(
__auth_obj: BurritoJWT = Depends(get_auth_core())
):
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"SEND_MESSAGE"})

comment: Comments | None = is_comment_exist_with_error(edit_comment_data.comment_id)
is_allowed_to_interact(comment, token_payload.user_id)
Expand All @@ -90,7 +90,7 @@ async def comments__delete(
__auth_obj: BurritoJWT = Depends(get_auth_core())
):
token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"SEND_MESSAGE"})

comment: Comments | None = is_comment_exist_with_error(deletion_comment_data.comment_id)
is_allowed_to_interact(comment, token_payload.user_id)
Expand All @@ -112,7 +112,7 @@ async def comments__get_related_comments(
"""Obtain comments related to the ticket"""

token_payload: AuthTokenPayload = await __auth_obj.verify_access_token()
check_permission(token_payload)
check_permission(token_payload, {"SEND_MESSAGE"})

ticket: Tickets | None = is_ticket_exist(filters.ticket_id)
if ticket.hidden:
Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/iofiles/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", iofiles_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/meta/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", meta_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/notifications/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", notifications_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/profile/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", profile_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/registration/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", registration_router)


Expand Down
2 changes: 1 addition & 1 deletion burrito/apps/tickets/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_APP_NAME = get_current_app_name()

app = get_current_app(docs_url=f"/{_APP_NAME}/docs", openapi_url=f"/{_APP_NAME}/openapi.json")
app = get_current_app(docs_url=f"/{_APP_NAME}/", openapi_url=f"/{_APP_NAME}/openapi.json")
connect_app(app, f"/{_APP_NAME}", tickets_router)


Expand Down
11 changes: 6 additions & 5 deletions burrito/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
from burrito.utils.redis_utils import get_redis_connector


_JWT_SECRET = get_config().BURRITO_JWT_SECRET
_TOKEN_TTL = get_config().BURRITO_JWT_TTL
_KEY_TEMPLATE = "{}_{}_{}"


class AuthTokenError(HTTPException):
...

Expand All @@ -18,11 +23,7 @@ class AuthTokenPayload(BaseModel):
token_type: str = ""
user_id: int
role: str


_JWT_SECRET = get_config().BURRITO_JWT_SECRET
_TOKEN_TTL = get_config().BURRITO_JWT_TTL
_KEY_TEMPLATE = "{}_{}_{}"
exp: int = _TOKEN_TTL


def _make_redis_key(data: AuthTokenPayload) -> str:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "Burrito"
version = "0.7.0.dev2"
version = "0.7.1.dev2"
description = "API for the issue tracker"
authors = ["DimonBor", "m-o-d-e-r"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_changelog.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

echo -e "\t==============================\n\tGenerated $(date '+%F %T')\n\t==============================\n\n" > \
echo -e "\t============================================\n\tGenerated $(date '+%F %T\t%Z %z')\n\t============================================\n\n" > \
CHANGELOG.md & git log --all --date=relative --pretty=format:"%x09 %h %ad %d %s (%aN)" >> \
CHANGELOG.md

0 comments on commit d394d9d

Please sign in to comment.