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

Read security access within OpenAPI #4957

Open
2 tasks
soyuka opened this issue Sep 16, 2022 · 1 comment
Open
2 tasks

Read security access within OpenAPI #4957

soyuka opened this issue Sep 16, 2022 · 1 comment

Comments

@soyuka
Copy link
Member

soyuka commented Sep 16, 2022

#[Put(security: "is_granted('ROLE_ADMIN') or object.owner == user")]

How to disable the PUT operation if not is_granted('ROLE_ADMIN') on the OpenAPI specification ?

Ideas:

  • Add an openapi security configuration (because object is not available)
  • Hack around the object.owner with a proxy ?

Implementation:

Create a new Normalizer that removes stuff from the open api doc (like https://github.com/api-platform/core/blob/main/src/OpenApi/Serializer/OpenApiNormalizer.php) or decorate the OpenApiFactory in a new factory. Do not add this to the current OpenApiFactory.

@soyuka
Copy link
Member Author

soyuka commented Oct 17, 2023

also #2719

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

No branches or pull requests

1 participant