docs icon indicating copy to clipboard operation
docs copied to clipboard

Add information on how to get a user in a provider

Open RobQuistNL opened this issue 2 years ago • 2 comments

As this is the most basic usecases for using a provider ever (showing entities that only relate to the current user), adding it to the docs would have saved me a lot of time.

There's way more docs to be updated - nothing seems to even remotely indicate some kind of ACL / User related data filtering.

Isn't it one of the most basic usecases ever? Where you want someone to only see their own data?

This usecase doesn't seem to be documented anywhere. It doesn't seem doable by using the annotations (albeit there's security and IRI overrides everywhere) it would never just shows this users' own stuff.

RobQuistNL avatar May 03 '23 09:05 RobQuistNL

This is only useful if you don't use Doctrine (or at least the built-in Doctrine provider), otherwise you should use an extension instead: https://api-platform.com/docs/core/extensions/

Could you make it clear in this page? Thanks for improving our docs!

dunglas avatar May 03 '23 21:05 dunglas

:exploding_head: it's called extensions...... (I am using Doctrine)

Okay, I had no idea. I found "filters" and "subresources" and "state providers" but I did not look at "extensions" for this type of filtering / ownership logic... (extensions, in my mind, are "extending" API-Platform. Not "Extending the automatically generated queries in ORM's" / "Query extensions")

Thanks for the quick review, I'll run through this stuff again and edit the docs.

RobQuistNL avatar May 03 '23 23:05 RobQuistNL