mirror of
https://github.com/SELinuxProject/setools
synced 2025-03-31 15:56:22 +00:00
setoolsgui: Use symbol name attribute where now possible.
This commit is contained in:
parent
bbb41965fd
commit
87f28f850f
@ -53,7 +53,7 @@ class BooleanTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(boolean)
|
||||
return boolean.name
|
||||
elif col == 1:
|
||||
return str(boolean.state)
|
||||
|
||||
|
@ -37,9 +37,9 @@ class BoundsTableModel(SEToolsTableModel):
|
||||
if col == 0:
|
||||
return item.ruletype.name
|
||||
elif col == 1:
|
||||
return str(item.parent)
|
||||
return item.parent.name
|
||||
elif col == 2:
|
||||
return str(item.child)
|
||||
return item.child.name
|
||||
|
||||
elif role == Qt.UserRole:
|
||||
return item
|
||||
|
@ -57,9 +57,9 @@ class CommonTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(item)
|
||||
return item.name
|
||||
elif col == 1:
|
||||
return ", ".join(sorted(str(p) for p in item.perms))
|
||||
return ", ".join(sorted(item.perms))
|
||||
|
||||
elif role == Qt.UserRole:
|
||||
return item
|
||||
|
@ -38,7 +38,7 @@ class ConstraintTableModel(SEToolsTableModel):
|
||||
if col == 0:
|
||||
return rule.ruletype.name
|
||||
elif col == 1:
|
||||
return str(rule.tclass)
|
||||
return rule.tclass.name
|
||||
elif col == 2:
|
||||
try:
|
||||
return ", ".join(sorted(rule.perms))
|
||||
|
@ -35,7 +35,7 @@ class InitialSIDTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(rule)
|
||||
return rule.name
|
||||
elif col == 1:
|
||||
return str(rule.context)
|
||||
|
||||
|
@ -78,9 +78,9 @@ class MLSComponentTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(item)
|
||||
return item.name
|
||||
elif col == 1:
|
||||
return ", ".join(sorted(str(a) for a in item.aliases()))
|
||||
return ", ".join(sorted(a for a in item.aliases()))
|
||||
|
||||
elif role == Qt.UserRole:
|
||||
return item
|
||||
|
@ -73,7 +73,7 @@ class ObjClassTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(item)
|
||||
return item.name
|
||||
elif col == 1:
|
||||
try:
|
||||
com_perms = item.common.perms
|
||||
|
@ -62,9 +62,9 @@ class RoleTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(item)
|
||||
return item.name
|
||||
elif col == 1:
|
||||
return ", ".join(sorted(str(t) for t in item.types()))
|
||||
return ", ".join(sorted(t.name for t in item.types()))
|
||||
elif role == Qt.UserRole:
|
||||
# get the whole object
|
||||
return item
|
||||
|
@ -59,9 +59,9 @@ class TypeAttributeTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(item)
|
||||
return item.name
|
||||
elif col == 1:
|
||||
return ", ".join(sorted(str(t) for t in item.expand()))
|
||||
return ", ".join(sorted(t.name for t in item.expand()))
|
||||
|
||||
elif role == Qt.UserRole:
|
||||
return item
|
||||
|
@ -65,11 +65,11 @@ class TypeTableModel(SEToolsTableModel):
|
||||
|
||||
if role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
return str(item)
|
||||
return item.name
|
||||
elif col == 1:
|
||||
return ", ".join(sorted(str(a) for a in item.attributes()))
|
||||
return ", ".join(sorted(a.name for a in item.attributes()))
|
||||
elif col == 2:
|
||||
return ", ".join(sorted(str(a) for a in item.aliases()))
|
||||
return ", ".join(sorted(a for a in item.aliases()))
|
||||
elif col == 3 and item.ispermissive:
|
||||
return "Permissive"
|
||||
|
||||
|
@ -75,9 +75,9 @@ class UserTableModel(SEToolsTableModel):
|
||||
user = self.resultlist[row]
|
||||
|
||||
if col == 0:
|
||||
return str(user)
|
||||
return user.name
|
||||
elif col == 1:
|
||||
return ", ".join(sorted(str(r) for r in user.roles))
|
||||
return ", ".join(sorted(r.name for r in user.roles))
|
||||
elif col == 2:
|
||||
try:
|
||||
return str(user.mls_level)
|
||||
|
Loading…
Reference in New Issue
Block a user