public $registerMediaConversionsUsingModelInstance = true;
protected static $_doctrineTypesMapping = ['int' => 'integer', 'longtext' => 'text'];
+
protected static $_permissionBase = null;
+ protected static $_permissionByOperation = true;
protected $connection = null;
protected $primaryKey = 'id';
protected $_enableRevisionsButton = false;
protected $_enableBulk = true;
+
protected $revisionEnabled = true;
protected $_flushCacheOnSave = true;
if (null === $user) {
return false;
}
- $permission = $this->getOption('permissions', static::$_permissionBase ?? $this->getOption('name')) . ':' . $operation;
+ $permission = $this->getOption('permissions', $this->_permission($operation));
return $user->can($permission);
}
+ protected function _permission($operation)
+ {
+ $res = static::$_permissionBase ?? $this->getOption('name');
+ if (static::$_permissionByOperation) {
+ $res .= ':' . $operation;
+ }
+
+ return $res;
+ }
+
protected function getAttributesForInsert()
{
$res = parent::getAttributesForInsert();