InfoFlowAnalysisTab: add perm_map property for getting map updates

Also fail to start analysis if no perm map is loaded.
This commit is contained in:
Chris PeBenito 2016-04-08 13:23:57 -04:00
parent 9d8258523d
commit 153f2acd7a

View File

@ -33,6 +33,14 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea):
"""An information flow analysis tab."""
@property
def perm_map(self):
return self.query.perm_map
@perm_map.setter
def perm_map(self, pmap):
self.query.perm_map = pmap
def __init__(self, parent, policy, perm_map):
super(InfoFlowAnalysisTab, self).__init__(parent)
self.log = logging.getLogger(__name__)
@ -51,6 +59,10 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea):
self.log.debug("Initializing UI.")
self.load_ui("infoflow.ui")
# set up error message for missing perm map
self.error_msg = QMessageBox(self)
self.error_msg.setStandardButtons(QMessageBox.Ok)
# set up source/target autocompletion
type_completion_list = [str(t) for t in self.policy.types()]
type_completer_model = QStringListModel(self)
@ -197,6 +209,13 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea):
self.set_target_error("A target type is required.")
fail = True
if not self.perm_map:
self.log.critical("A permission map is required to begin the analysis.")
self.error_msg.critical(self,
"No permission map available.",
"Please load a permission map to begin the analysis.")
fail = True
if fail:
return