protected function onBeforeEdit()
{
/** @var DataModel $model */
$model = $this->getModel();
// It seems that I can't edit records, maybe I can edit only this one due asset tracking?
if (!$this->permissions->edit || !$this->permissions->editown) {
if ($model) {
// Ok, record is tracked, let's see if I can this record
if ($model->isAssetsTracked()) {
$platform = $this->container->platform;
if (!$this->permissions->edit) {
$this->permissions->edit = $platform->authorise('core.edit', $model->getAssetName());
}
if (!$this->permissions->editown) {
$this->permissions->editown = $platform->authorise('core.edit.own', $model->getAssetName());
}
}
}
}
$this->item = $model->findOrFail();
}