- Posts: 14
- Thank you received: 1
The developer takes a few days off for Holidays...
...and will be back with charged battery!
From 23 December to 2 January included
During this period, assistance from developer will not be provided.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
use VersionableControllerTrait;
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = $this->app->getIdentity();
// Zero record (id:0), return component edit permission by calling parent controller method
if (!$recordId) {
return parent::allowEdit($data, $key);
}
// Check edit on the record asset (explicit or inherited)
if ($user->authorise('core.edit', 'com_icagenda.event.' . $recordId)) {
return true;
}
// Check edit own on the record asset (explicit or inherited)
if ($user->authorise('core.edit.own', 'com_icagenda.event.' . $recordId)) {
// Existing record already has an owner, get it
$record = $this->getModel()->getItem($recordId);
if (empty($record)) {
return false;
}
// Grant if current user is owner of the record
return $user->id == $record->created_by;
}
return false;
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
// Grant if current user is owner of the record
if ($user->id == $record->created_by || $user->id == $record->userid) {
return true;
}
Please Log in or Create an account to join the conversation.