Skip to content

Commit

Permalink
Remove permission map parameter from analysis tabs.
Browse files Browse the repository at this point in the history
This is not the common case.

Signed-off-by: Chris PeBenito <pebenito@ieee.org>
  • Loading branch information
pebenito committed Dec 5, 2023
1 parent 80bd886 commit 2eb2eea
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 83 deletions.
4 changes: 2 additions & 2 deletions setoolsgui/apol.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ def create_new_analysis(self, tab_class: type[widgets.tab.BaseAnalysisTabWidget]
assert self.policy
assert self.permmap

new_tab = tab_class(self.policy, self.permmap,
parent=self)
new_tab = tab_class(self.policy, parent=self)
new_tab.handle_permmap_change(self.permmap)
new_tab.setObjectName(counted_name)
self.permmap_changed.connect(new_tab.handle_permmap_change)
index = self.addTab(new_tab, counted_name)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/boolquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class BoolQueryTab(tab.TableResultTabWidget):
tab_title = "Booleans"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.BoolQuery(policy), None, enable_criteria=True,
super().__init__(setools.BoolQuery(policy), enable_criteria=True,
enable_browser=True, parent=parent)

self.setWhatsThis("<b>Search Booleans in a SELinux policy.</b>")
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = BoolQueryTab(setools.SELinuxPolicy(), mw)
widget = BoolQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/commonquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class CommonQueryTab(tab.TableResultTabWidget):
tab_title = "Common Permision Sets"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.CommonQuery(policy), None, enable_criteria=True,
super().__init__(setools.CommonQuery(policy), enable_criteria=True,
enable_browser=True, parent=parent)

self.setWhatsThis("<b>Search common permission sets in an SELinux policy.</b>")
Expand Down Expand Up @@ -67,7 +67,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = CommonQueryTab(setools.SELinuxPolicy(), mw)
widget = CommonQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
7 changes: 3 additions & 4 deletions setoolsgui/widgets/constraintquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class ConstraintQueryTab(tab.TableResultTabWidget):
tab_title = "Constraints"
mlsonly = False

def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.ConstraintQuery(policy), None, enable_criteria=True,
parent=parent)
super().__init__(setools.ConstraintQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search constraints in a SELinux policy.</b>")

Expand Down Expand Up @@ -130,7 +129,7 @@ def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = ConstraintQueryTab(setools.SELinuxPolicy(), mw)
widget = ConstraintQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(widget.size())
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/fsusequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class FSUseQueryTab(tab.TableResultTabWidget):
tab_title = "Fs_use_*"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.FSUseQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.FSUseQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search fs_use_* statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -68,7 +68,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = FSUseQueryTab(setools.SELinuxPolicy(), mw)
widget = FSUseQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/genfsconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class GenfsconQueryTab(tab.TableResultTabWidget):
tab_title = "Genfscons"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.GenfsconQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.GenfsconQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search genfscon statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -67,7 +67,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = GenfsconQueryTab(setools.SELinuxPolicy(), mw)
widget = GenfsconQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
7 changes: 3 additions & 4 deletions setoolsgui/widgets/ibendportconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class IbendportconQueryTab(tab.TableResultTabWidget):
tab_title = "Infiniband Endport Contexts"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.IbendportconQuery(policy), None, enable_criteria=True,
parent=parent)
super().__init__(setools.IbendportconQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search ibendportcon statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -67,7 +66,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = IbendportconQueryTab(setools.SELinuxPolicy(), None, parent=mw)
widget = IbendportconQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
7 changes: 3 additions & 4 deletions setoolsgui/widgets/ibpkeyconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class IbpkeyconQueryTab(tab.TableResultTabWidget):
tab_title = "Infiniband Partition Key Contexts"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.IbpkeyconQuery(policy), None, enable_criteria=True,
parent=parent)
super().__init__(setools.IbpkeyconQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search ibpkeycon statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -66,7 +65,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = IbpkeyconQueryTab(setools.SELinuxPolicy(), None, parent=mw)
widget = IbpkeyconQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
9 changes: 6 additions & 3 deletions setoolsgui/widgets/infoflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ class InfoFlowAnalysisTab(tab.DirectedGraphResultTab[setools.InfoFlowAnalysis]):
tab_title = "Information Flow Analysis"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, perm_map: setools.PermissionMap, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.InfoFlowAnalysis(policy, perm_map), perm_map,
permmap = setools.PermissionMap()
permmap.map_policy(policy)

super().__init__(setools.InfoFlowAnalysis(policy, permmap),
enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Information flow analysis of an SELinux policy.</b>")
Expand Down Expand Up @@ -315,7 +318,7 @@ def load(self, settings: dict) -> None:

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = InfoFlowAnalysisTab(setools.SELinuxPolicy(), setools.PermissionMap(), parent=mw)
widget = InfoFlowAnalysisTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(widget.size())
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/initsidquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class InitialSIDQueryTab(tab.TableResultTabWidget):
tab_title = "Initial Contexts"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.InitialSIDQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.InitialSIDQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search initial context statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -61,7 +61,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = InitialSIDQueryTab(setools.SELinuxPolicy(), mw)
widget = InitialSIDQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/mlsrulequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class MLSRuleQueryTab(tab.TableResultTabWidget):
tab_title = "Multi-Level Security (MLS) Rules"
mlsonly = True

def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,
def __init__(self, policy: "setools.SELinuxPolicy", /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.MLSRuleQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.MLSRuleQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search Type Enforcement rules in a SELinux policy.</b>")

Expand Down Expand Up @@ -132,7 +132,7 @@ def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = MLSRuleQueryTab(setools.SELinuxPolicy(), mw)
widget = MLSRuleQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(widget.size())
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/netifconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class NetifconQueryTab(tab.TableResultTabWidget):
tab_title = "Network Interface Contexts"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.NetifconQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.NetifconQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search netifcon statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -61,7 +61,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = NetifconQueryTab(setools.SELinuxPolicy(), mw)
widget = NetifconQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
7 changes: 3 additions & 4 deletions setoolsgui/widgets/nodeconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class NodeconQueryTab(tab.TableResultTabWidget):
tab_title = "Network Node Contexts"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.NodeconQuery(policy), None, enable_criteria=True,
parent=parent)
super().__init__(setools.NodeconQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search nodecon statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -69,7 +68,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = NodeconQueryTab(setools.SELinuxPolicy(), None, parent=mw)
widget = NodeconQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/portconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class PortconQueryTab(tab.TableResultTabWidget):
tab_title = "Network Port Contexts"
mlsonly = False

def __init__(self, policy: setools.SELinuxPolicy, _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.PortconQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.PortconQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search portcon statements in a SELinux policy.</b>")

Expand Down Expand Up @@ -101,7 +101,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = PortconQueryTab(setools.SELinuxPolicy(), mw)
widget = PortconQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(1280, 1024)
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/widgets/rbacrulequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class RBACRuleQueryTab(tab.TableResultTabWidget):
tab_title = "Role-based Access Control (RBAC) Rules"
mlsonly = False

def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(setools.RBACRuleQuery(policy), None, enable_criteria=True, parent=parent)
super().__init__(setools.RBACRuleQuery(policy), enable_criteria=True, parent=parent)

self.setWhatsThis("<b>Search RBAC rules in a SELinux policy.</b>")

Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = RBACRuleQueryTab(setools.SELinuxPolicy(), mw)
widget = RBACRuleQueryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(widget.size())
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
11 changes: 5 additions & 6 deletions setoolsgui/widgets/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#
# SPDX-License-Identifier: LGPL-2.1-only

import typing

from PyQt6 import QtCore, QtGui, QtWidgets
import setools

from . import tab

Expand All @@ -20,11 +19,11 @@ class SummaryTab(tab.BaseAnalysisTabWidget):
tab_title = "SELinux Policy Summary"
mlsonly = False

def __init__(self, policy: "setools.SELinuxPolicy", _, /, *,
def __init__(self, policy: setools.SELinuxPolicy, /, *,
parent: QtWidgets.QWidget | None = None) -> None:

super().__init__(policy, None, enable_criteria=False, parent=parent)
self.policy: typing.Final = policy
super().__init__(policy, enable_criteria=False, parent=parent)
self.policy = policy

# font for labels
font = QtGui.QFont()
Expand Down Expand Up @@ -210,7 +209,7 @@ def query_failed(self, message: str) -> None:

app = QtWidgets.QApplication(sys.argv)
mw = QtWidgets.QMainWindow()
widget = SummaryTab(setools.SELinuxPolicy(), None, parent=mw)
widget = SummaryTab(setools.SELinuxPolicy(), parent=mw)
mw.setCentralWidget(widget)
mw.resize(widget.size())
whatsthis = QtWidgets.QWhatsThis.createAction(mw)
Expand Down
Loading

0 comments on commit 2eb2eea

Please sign in to comment.