Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Schema Validation first before check permissions. #192

Open
Elixir-MeetThoriya opened this issue Oct 16, 2024 · 5 comments
Open

Check Schema Validation first before check permissions. #192

Elixir-MeetThoriya opened this issue Oct 16, 2024 · 5 comments

Comments

@Elixir-MeetThoriya
Copy link

class UserPasswordSchema(Schema):
    password: str

    @login_required
    @model_validator(mode='after')
    @classmethod
    def check_password(cls, obj):
        check_user_password(password=obj.password)
        return obj

class UserResetPasswordSchema(UserPasswordSchema):
    pass
@http_post(
        path="{user_id}/reset-password/",
        response={
            HTTPStatus.OK: SuccessSchema,
            HTTPStatus.INTERNAL_SERVER_ERROR: ErrorSchema,
            HTTPStatus.BAD_REQUEST: ErrorSchema,
        },
        permissions=[AdminPermission],
        summary="Reset User Password",
        description="Allows admins to reset a user's password using their user ID.",
        url_name="reset_user_password"
    )
    def reset_password(self, user_id: int, payload: UserResetPasswordSchema):
           pass

why permissions check after the schema validation ??

@Elixir-MeetThoriya Elixir-MeetThoriya changed the title Check Schema Validation after that check permissions. Check Schema Validation first before check permissions. Oct 16, 2024
@eadwinCode
Copy link
Owner

@Elixir-MeetThoriya I don't get your question

@Elixir-MeetThoriya
Copy link
Author

Elixir-MeetThoriya commented Oct 21, 2024

when try to hit api,
can't check permission first
(here check schema validations first , after that check permissions ) # not valid

@eadwinCode
Copy link
Owner

Oh okay. This is a challenge currently. I will try and dedicate some time to fix this

@eadwinCode
Copy link
Owner

@Elixir-MeetThoriya can you check with the latest release if the issue is resolved

@Elixir-MeetThoriya
Copy link
Author

sure, Thanks @eadwinCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants