From: Leo Nunner <l.nunner@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH WIP api/gui] Extend rule system
Date: Thu, 14 Sep 2023 11:52:21 +0200 [thread overview]
Message-ID: <20230914095234.115469-1-l.nunner@proxmox.com> (raw)
This is a WIP series to rework the PMG rule system by adding the
capabiliy to negate and group objects inside rules. Negated objects will
only match if their conditions are not met.
Match groups allow objects of the same type to be grouped together. A
match group evaluates like one big object, only evaluating as a match if
all objects that are contained inside the group match. In contrast to
previous versions, it is now possible to have multiple match groups for
each object type. They can also be named to make their purpose clearer
at first glance.
Match groups can be visualized as follows:
Rule
- 'Who' Objects
- Match group
Object 1
Object 2
Object 3
- Object 4
The 'Who' objects will only match if either (Object 1 AND Object 2 AND
Object 3) evaluates to true, or if Object 4 evaluates to true. This
means that match groups are connected via logical OR to all other
top-level objects inside the rule, while all objects contained inside
the group are connected via logical AND.
Since this series is still WIP and has been changed since the last
iteration, some things are still missing:
- The matching logic for negation needs proper implementation
The last iteration of this series had some fundamental errors in
how negation was handled for some object types. Especially for
'What' objects it can be rather hard to define what negation
entails.
- The matching logic for match groups
Since we now have multiple match groups for each object type,
the matching logic needs to be adapted accordingly. This could
be achieved by first going through all objects which do not have
their MatchGroup field set, and then going through all match
groups associated with that rule (the facilities for which are
already there).
- UI Tweaks
The UI for match groups still needs some tweaks, such as edit
functionality for match groups (which also still needs to be
implemented in the API), reloading the tree after adding a
group, and maybe changing some icons (negation comes to mind).
pmg-api:
Leo Nunner (11):
negation: add field to database
negation: parse negation value into objects
negation: expand/implement API endpoints
negation: implement matching logic
match groups: update database schema
match groups: add functions for database access
match groups: parse field into objects
match groups: add API endpoints for create/delete
match groups: list match groups in rule API
match groups: update existing object API endpoints
match groups: implement matching logic
src/PMG/API2/ObjectGroupHelpers.pm | 10 +-
src/PMG/API2/RuleDB.pm | 4 +-
src/PMG/API2/Rules.pm | 202 ++++++++++++++++++++++++-
src/PMG/DBTools.pm | 40 +++++
src/PMG/RuleCache.pm | 61 ++++++--
src/PMG/RuleDB.pm | 131 +++++++++++++++-
src/PMG/RuleDB/ArchiveFilter.pm | 6 +-
src/PMG/RuleDB/ContentTypeFilter.pm | 6 +-
src/PMG/RuleDB/MatchArchiveFilename.pm | 4 +-
src/PMG/RuleDB/MatchField.pm | 2 +-
src/PMG/RuleDB/MatchFilename.pm | 2 +-
11 files changed, 445 insertions(+), 23 deletions(-)
pmg-gui:
Leo Nunner (2):
negate objects inside rules
introduce logical 'and' for rules
css/ext6-pmg.css | 20 +++
js/RuleInfo.js | 433 +++++++++++++++++++++++++++++++++++++++--------
js/Utils.js | 14 +-
3 files changed, 391 insertions(+), 76 deletions(-)
--
2.39.2
next reply other threads:[~2023-09-14 9:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 9:52 Leo Nunner [this message]
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 01/11] negation: add field to database Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 02/11] negation: parse negation value into objects Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 03/11] negation: expand/implement API endpoints Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 04/11] negation: implement matching logic Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 05/11] match groups: update database schema Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 06/11] match groups: add functions for database access Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 07/11] match groups: parse field into objects Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 08/11] match groups: add API endpoints for create/delete Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 09/11] match groups: list match groups in rule API Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 10/11] match groups: update existing object API endpoints Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP api 11/11] match groups: implement matching logic Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP gui 1/2] negate objects inside rules Leo Nunner
2023-09-14 9:52 ` [pmg-devel] [PATCH WIP gui 2/2] introduce logical 'and' for rules Leo Nunner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230914095234.115469-1-l.nunner@proxmox.com \
--to=l.nunner@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox