F
Filament3mo ago
Gaurav

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:
Finally figured it out:
Actions\ImportAction::make()
->importer(UserImporter::class)
->authorize('create'),
Actions\ImportAction::make()
->importer(UserImporter::class)
->authorize('create'),
...
Jump to solution
1 Reply
Solution
Gaurav
Gaurav3mo ago
Finally figured it out:
Actions\ImportAction::make()
->importer(UserImporter::class)
->authorize('create'),
Actions\ImportAction::make()
->importer(UserImporter::class)
->authorize('create'),