Skip to content

Commit

Permalink
Merge pull request #58 from flavien-hugs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
flavien-hugs authored Nov 25, 2024
2 parents c364d43 + f7f12fa commit 0619b70
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from fastapi_cache.decorator import cache
from slugify import slugify

from src.common.helpers.caching import custom_key_builder, delete_custom_key
from src.config import enable_endpoint, settings
from src.common.helpers.caching import custom_key_builder
from src.middleware import AuthorizedHTTPBearer
from src.models import User
from src.schemas import (
Expand Down Expand Up @@ -76,6 +76,8 @@ async def resend_otp_code(bg: BackgroundTasks, payload: PhonenumberModel = Body(
"/logout", dependencies=[Depends(AuthorizedHTTPBearer)], summary="Logout User", status_code=status.HTTP_200_OK
)
async def logout(request: Request):
await delete_custom_key(service_appname_slug + "access")
await delete_custom_key(service_appname_slug + "validate")
return await auth.logout(request)


Expand Down
6 changes: 6 additions & 0 deletions src/routers/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
from fastapi import APIRouter, Body, Depends, Query, status
from fastapi_pagination.ext.beanie import paginate
from pymongo import ASCENDING, DESCENDING
from slugify import slugify

from src.common.helpers.caching import delete_custom_key
from src.config import enable_endpoint, settings
from src.middleware import AuthorizedHTTPBearer, CheckPermissionsHandler
from src.models import Role
from src.schemas import RoleModel
from src.services import roles
from src.shared.utils import customize_page, SortEnum

service_appname_slug = slugify(settings.APP_NAME)

role_router = APIRouter(prefix="/roles", tags=["ROLES"], redirect_slashes=False)


Expand Down Expand Up @@ -141,4 +145,6 @@ async def get_role_members(
status_code=status.HTTP_200_OK,
)
async def manage_permission_to_role(id: PydanticObjectId, payload: Set[str] = Body(...)):
await delete_custom_key(service_appname_slug + "access")
await delete_custom_key(service_appname_slug + "validate")
return await roles.assign_permissions_to_role(role_id=PydanticObjectId(id), permission_codes=payload)

0 comments on commit 0619b70

Please sign in to comment.