When a MenuLink() object is created via gridfield, it does not have either a ParentID nor a MenuSetID field. This causes canEdit() on the object to return false (except for ADMIN) users. The form is thus read-only and the user cannot create the record.
To resolve this, we ensure that MenuSet::canEdit() only checks for the specific permission if it is saved to the database. If it's a singleton, fail back to cms permissions.
Note that MenuLink::canCreate() still safely checks if the object can be created for a specific menuset. canEdit() unfortunately is called during the form rendering, which doesn't know about that parent.
When a MenuLink() object is created via gridfield, it does not have either a ParentID nor a MenuSetID field. This causes canEdit() on the object to return false (except for ADMIN) users. The form is thus read-only and the user cannot create the record.
To resolve this, we ensure that MenuSet::canEdit() only checks for the specific permission if it is saved to the database. If it's a singleton, fail back to cms permissions.
Note that MenuLink::canCreate() still safely checks if the object can be created for a specific menuset. canEdit() unfortunately is called during the form rendering, which doesn't know about that parent.
cc @gorriecoe for review.