flip_api.user_services.retrieve_user_permissions ================================================ .. py:module:: flip_api.user_services.retrieve_user_permissions Attributes ---------- .. autoapisummary:: flip_api.user_services.retrieve_user_permissions.router Functions --------- .. autoapisummary:: flip_api.user_services.retrieve_user_permissions.has_role flip_api.user_services.retrieve_user_permissions.get_user_permissions flip_api.user_services.retrieve_user_permissions.retrieve_user_permissions Module Contents --------------- .. py:data:: router .. py:function:: has_role(user_id: uuid.UUID, db: sqlmodel.Session) -> bool Check if a user has at least one role assigned. :param user_id: The unique identifier of the user. :type user_id: UUID :param db: The database session. :type db: Session :returns: True if the user has at least one role, False otherwise. :rtype: bool .. py:function:: get_user_permissions(user_id: uuid.UUID, db: sqlmodel.Session) -> list[flip_api.db.models.user_models.Permission] Retrieve all permissions for a given user based on their roles. :param user_id: The unique identifier of the user. :type user_id: UUID :param db: The database session. :type db: Session :returns: A list of Permission objects associated with the user's roles. :rtype: list[Permission] .. py:function:: retrieve_user_permissions(user_id: uuid.UUID, db: sqlmodel.Session = Depends(get_session), token_id: uuid.UUID = Depends(verify_token)) -> flip_api.domain.schemas.users.UserPermissionsResponse Retrieves the list of permissions associated with a specific user ID. :param user_id: The unique identifier of the user whose permissions are being retrieved. :type user_id: UUID :param db: The database session, provided by dependency injection. :type db: Session :param token_id: The unique identifier of the authenticated user making the request. :type token_id: UUID :returns: An object containing a list of permissions associated with the user. :rtype: UserPermissionsResponse :raises HTTPException: If the user ID does not match the token ID (i.e., users can only access their own permissions), :raises if the user does not exist or has no roles assigned, or if there is an unexpected error while retrieving: :raises permissions.: