F
Filamentagragaurav

ImportPolicy

I wish to authorize imports of models based on model specific permissions. How can I control it using ImportPolicy? For example, I've explicitly given a permission users.create to a particular role. Now, I wish only the users with that role to be able to import users data. Similarly, a roles.create permission exists for some other roles. And users with those roles should be able to import roles data.
Solution
A
agragaurav29d ago
Finally figured it out:
Actions\ImportAction::make()
->importer(UserImporter::class)
->authorize('create'),
Actions\ImportAction::make()
->importer(UserImporter::class)
->authorize('create'),