Skip to content

Commit

Permalink
ui,ruleseditor: add rules correctly to the db
Browse files Browse the repository at this point in the history
Operator list was not converted to JSON string when saving the rule to
the DB.

Related: #1047
  • Loading branch information
gustavo-iniguez-goya committed Oct 10, 2023
1 parent 32e7325 commit 6714926
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions ui/opensnitch/dialogs/ruleseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,17 +581,7 @@ def _load_nodes(self, addr=None):
def _insert_rule_to_db(self, node_addr):
# the order of the fields doesn't matter here, as long as we use the
# name of the field.
self._db.insert("rules",
"(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"
)
self._rules.add_rules(node_addr, [self.rule])

def _add_rule(self):
try:
Expand Down

0 comments on commit 6714926

Please sign in to comment.