Skip to content

Bug: Front end renders Delete Selected, Restore Selected, Force Delete Selected regardless of Policy and/or resource Authorization Setting #6831

@robertmarney

Description

@robertmarney
  • Laravel Version: 11.38.2
  • Nova Version: 5.2.7
  • PHP Version: 8.3.1
  • Database Driver & Version: MYSQL 8.0
  • Operating System and Version: Ubuntu 22.04

Description:

When all resources are selected the trash can icon appears providing options to delete, restore, and force delete selected even when Policy or Resource explicitly disallow.

Previous Reports:

As communicated in the past before closing previous bug reports, there is concern about hydrating many model instances (each model is checked individually).

This issue is not new, however has been ignored repeatedly (not exhaustive):

Still a Bug:

Performance considerations not-withstanding this is a bug, a button that should not be mounted is mounted and the user is left confused to why their intentional action is "not working".

Suggest Go-Forward:

A. Introduce a resource level policy check e.g. canDeleteAny(User $user): false - If present in policy short circuit the check (before model hydration)
B. Introduce a Resource property to disable the select all button

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions