Skip to content

Commit 261df82

Browse files
committed
[GRASS] disable drop to mapsets not owned
1 parent 295d64b commit 261df82

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/providers/grass/qgsgrassprovidermodule.cpp‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,10 @@ bool QgsGrassMapsetItem::objectInImports( QgsGrassObject grassObject )
398398
}
399399
if ( import->names().contains( grassObject.name() ) )
400400
{
401-
return true;
401+
return true; if ( !QgsGrass::isOwner( mGrassObject.gisdbase(), mGrassObject.location(), mGrassObject.mapset() ) )
402+
{
403+
return false;
404+
}
402405
}
403406
}
404407
return false;
@@ -603,6 +606,11 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
603606
return items;
604607
}
605608

609+
bool QgsGrassMapsetItem::acceptDrop()
610+
{
611+
return QgsGrass::isOwner( mGrassObject.gisdbase(), mGrassObject.location(), mGrassObject.mapset() );
612+
}
613+
606614
bool QgsGrassMapsetItem::handleDrop( const QMimeData * data, Qt::DropAction )
607615
{
608616
if ( !QgsMimeDataUtils::isUriList( data ) )

‎src/providers/grass/qgsgrassprovidermodule.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class QgsGrassMapsetItem : public QgsDirectoryItem, public QgsGrassObjectItemBas
9494

9595
QVector<QgsDataItem*> createChildren() override;
9696
virtual QList<QAction*> actions() override { return mActions->actions(); }
97-
virtual bool acceptDrop() override { return true; }
97+
virtual bool acceptDrop() override;
9898
virtual bool handleDrop( const QMimeData * data, Qt::DropAction action ) override;
9999

100100
public slots:

0 commit comments

Comments
 (0)