atk4 / ui

Robust and easy to use PHP Framework for Web Apps
https://atk4-ui.readthedocs.io/en/stable/
MIT License
447 stars 106 forks source link

Run UA scope validation earlier than before execute #2228

Closed mvorisek closed 17 hours ago

mvorisek commented 1 day ago

Steps to reproduce:

  1. remove the ID args at https://github.com/atk4/ui/blob/5.2.0/demos/data-action/jsactions2.php#L46
  2. open https://ui.atk4.org/demos/data-action/jsactions2.php#L46 and notice "preview" emits Atk4\Data\Exception: User action can be executed on loaded entity only

The same exception is expected immediatelly for "delete" (ie. before confirmation) and for "edit" (ie. before modal is displayed and saved).

The validation is currently done in UA before execute/preview only in https://github.com/atk4/data/blob/5.2.0/src/Model/UserAction.php#L186.