Commit b4573c0d authored by Staiger, Christine's avatar Staiger, Christine
Browse files

Adjusting irodsTreeView to Treeview in branch GUI.

parent e116765f
......@@ -19,6 +19,9 @@ class IrodsModel(QStandardItemModel):
super(IrodsModel, self).__init__(parent)
self._checked_indeces = set()
self.ic = irods_session
#Groups which the user id member of to check access rights on tree
self.userGroups = self.ic.getUserInfo()[1]
self.irodsRootColl = "/" +
self.TreeView = TreeView
self.clear() # Empty tree
......@@ -39,13 +42,22 @@ class IrodsModel(QStandardItemModel):
def setData(self, index, value, role=Qt.EditRole):
if role == Qt.CheckStateRole:
#filename =
if value == Qt.Checked:
#check irods ACLs for access rights
path = self.irodsPathFromTreeIdx(index)
reqAcls = [('own', path, group, for group in self.userGroups]
reqAcls.extend([('write', path, group, \
for group in self.userGroups])
acls = set([(acl.access_name, acl.path, acl.user_name, acl.user_zone)
for acl in self.ic.getPermissions(path)])
# Block checking of home item (found no easy way to remove the checkbox)
if == "home":
message = "Cannot up/download to home collection"
QMessageBox.information(self.TreeView,'Error', message)
if acls.intersection(reqAcls) == set():
message = "ERROR, insufficient rights:\nCannot select "+path
QMessageBox.information(self.TreeView, 'Error', message)"Filedownload:" + message)
return False
......@@ -203,6 +215,19 @@ class IrodsModel(QStandardItemModel):
seen[irodsID] = parent.child(parent.rowCount() - 1)
def getParentIdx(self, position):
try: #index when right mouse click
modelIndex = self.tree.indexAt(position)
if not modelIndex.isValid():
except: #index when expand is clicked
modelIndex = position
treeItem = self.itemFromIndex(modelIndex)
parent = treeItem.parent()
def refreshSubTree(self, position):
try: #index when right mouse click
modelIndex = self.tree.indexAt(position)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment