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

Can we override the API request for slugify/slugs #39

Closed
selected-pixel-jameson opened this issue Mar 15, 2022 · 7 comments
Closed

Can we override the API request for slugify/slugs #39

selected-pixel-jameson opened this issue Mar 15, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@selected-pixel-jameson
Copy link
Contributor

Is there a way to override the slugify/slugs endpoint? I have a specific use case where I want to perform additional security checks before returning a response.

@ComfortablyCoding ComfortablyCoding added the enhancement New feature or request label Mar 16, 2022
@ComfortablyCoding
Copy link
Contributor

Override as in additional custom policies?

@selected-pixel-jameson
Copy link
Contributor Author

Maybe that's how one would go about this. I'm still very new to Strapi. I was just looking for a way to be able to override this function similar to how you override find, findOne, create or update.

@ComfortablyCoding
Copy link
Contributor

ah, that I am not sure. What checks are you trying to do?

@selected-pixel-jameson
Copy link
Contributor Author

selected-pixel-jameson commented Mar 17, 2022

I took a look at policies. Yes, I'm looking for a way to attach a custom policy to this.

I need a way to add a layer of security to this request so that a response is only returned when the request is for content that is explicitly flagged as 'public' and this needs to be set on the server for security purposes. I can't do this using a query on the client.

I also need to check to see if the user making the request has the ability to edit the content which is determined by various properties on the model being requested.

@ComfortablyCoding
Copy link
Contributor

ComfortablyCoding commented Mar 17, 2022

Model specific policies should already be supported v2.1.1+.

By default it behaves like any other route. If the user who requested the model does not have permission to find it then it will return unauthorized.

I do not have the chance to confirm this at the moment but any additional policies on the model(s) should also be respected.

@selected-pixel-jameson
Copy link
Contributor Author

selected-pixel-jameson commented Mar 17, 2022 via email

@ComfortablyCoding
Copy link
Contributor

No problem, closing for now. It can be reopened if model policies are not being respected.

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

No branches or pull requests

2 participants