php - Restrict access to product status on user role

one text

Solution:

Restrict Access to Actions

Use the setPermission() method to define the security permission required to see the action link/button:

public function configureActions(Actions $actions): Actions
{
    $viewPending = Action::new('pending', 'View preding', 'fa fa-file-invoice')
        ->linkToCrudAction('renderPending');

    $viewRecieved = Action::new('recieved', 'View recieved', 'fa fa-file-invoice')
        ->linkToCrudAction('renderRecieved');
    ...

    return $actions
        // ...
        ->add(Crud::PAGE_DETAIL, $viewInvoice)
        // use the 'setPermission()' method to set the permission of actions
        // (the same permission is granted to the action on all pages)
        ->setPermission('pending', 'USER_ADMIN')

        // ...
        ->add(Crud::PAGE_DETAIL, $viewRecieved)
        // use the 'setPermission()' method to set the permission of actions
        // (the same permission is granted to the action on all pages)
        ->setPermission('recieved', 'USER_PRODUCT')
    ;
}

Source