mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui,ruleseditor: add rules correctly to the db
Operator list was not converted to JSON string when saving the rule to the DB. Related: #1047
This commit is contained in:
parent
32e73257f9
commit
67149269cd
1 changed files with 1 additions and 11 deletions
|
@ -581,17 +581,7 @@ class RulesEditorDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||||
def _insert_rule_to_db(self, node_addr):
|
def _insert_rule_to_db(self, node_addr):
|
||||||
# the order of the fields doesn't matter here, as long as we use the
|
# the order of the fields doesn't matter here, as long as we use the
|
||||||
# name of the field.
|
# name of the field.
|
||||||
self._db.insert("rules",
|
self._rules.add_rules(node_addr, [self.rule])
|
||||||
"(time, node, name, description, enabled, precedence, nolog, action, "\
|
|
||||||
"duration, operator_type, operator_sensitive, operator_operand, operator_data, created)",
|
|
||||||
(datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
||||||
node_addr, self.rule.name, self.rule.description,
|
|
||||||
str(self.rule.enabled), str(self.rule.precedence), str(self.rule.nolog),
|
|
||||||
self.rule.action, self.rule.duration, self.rule.operator.type,
|
|
||||||
str(self.rule.operator.sensitive), self.rule.operator.operand, self.rule.operator.data,
|
|
||||||
str(datetime.fromtimestamp(self.rule.created).strftime("%Y-%m-%d %H:%M:%S"))),
|
|
||||||
action_on_conflict="REPLACE"
|
|
||||||
)
|
|
||||||
|
|
||||||
def _add_rule(self):
|
def _add_rule(self):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue