Skip to content
Snippets Groups Projects
Commit b4573c0d authored by Staiger, Christine's avatar Staiger, Christine
Browse files

Adjusting irodsTreeView to Treeview in branch GUI.

parent e116765f
No related branches found
No related tags found
No related merge requests found
......@@ -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.ic.session.zone
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 = self.data(index)
if value == Qt.Checked:
#check irods ACLs for access rights
path = self.irodsPathFromTreeIdx(index)
reqAcls = [('own', path, group, self.ic.session.zone) for group in self.userGroups]
reqAcls.extend([('write', path, group, self.ic.session.zone) \
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 self.data(index) == "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)
#logging.info("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():
return
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment