Closed de-raaf-media closed 2 months ago
You can hook into the query used for listings.
https://statamic.dev/extending/hooks#entry-index-query-query
See https://github.com/statamic/cms/pull/10479
use Statamic\Hooks\CP\EntriesIndexQuery;
EntriesIndexQuery::hook('query', function ($payload, $next) {
$payload->query->where('author', User::current()->id());
return $next($payload);
});
Thanks @jasonvarga, that actually helped me a lot!
My feature request remains. It would be nice to have this permission available by default :-)
I did a quick search but I don't think this feature request exists yet. In my Statamic project I have multiple users. I don't want to show my users entries that they cannot edit (other authors entries). But there does not seem to be a rule for this. Is there a reason for this?
Is it possible to add a rule for this? Or can I somehow achieve this myself?
Currently these rules are available for other authors entries.
'edit_otherauthors{collection}_entries' => "Edit other authors' entries", 'publish_otherauthors{collection}_entries' => "Manage publish state of other authors' entries", 'delete_otherauthors{collection}_entries' => "Delete other authors' entries",
I would very much like a new rule: 'view_otherauthors{collection}_entries' => "View other authors' entries",
Regards, Mark