ideas
ideas copied to clipboard
CP: Possiblity to add a Custom Asset Policy for hiding Assets under certain conditions
I tried adding an AssetPolicy class and binding it in my ServiceContainer.
$this->app->bind(\Statamic\Policies\AssetPolicy::class, AssetPolicy::class);
Unfortunately that does not work when returning false in the view() method.
Are you logged in as a super user?
No, i tested it for a non-super user.
Looks like you're right. Some actions get disabled but you can still open up the editor and look at it.
Even if it worked, it wouldn't hide from listings. It would only prevent you from opening the editor. We'd need to introduce https://github.com/statamic/cms/pull/10479 but for assets.
But, if you customize edit to return false, it does at least stop you from saving the asset.
A query hook for the assets would be really helpful in my case. 👌🏼