Commit Graph

22 Commits

Author SHA1 Message Date
8b62a88f0b
feat: replace hatchling to setuptools can be packaged easily at distros
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
2024-09-22 01:07:15 +03:00
81c79895ed
Correct README reference in pyproject
File suffix was changed, reference was forgotten to be updated.

Fixes: eaf8f6085e ("Add proper README")
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-21 20:13:51 +02:00
97299af765
Move test.sh
Align with the other script which is already under scripts/.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-20 19:12:28 +02:00
eaf8f6085e
Add proper README
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-20 19:00:54 +02:00
7fec5bc64b
Document functions
Add docstrings to better depict how the functions are intended to be used.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-20 18:38:54 +02:00
63fe0597c1
Rename functions
Use function names which are both more uniform and more easily
understandable by humans.
Drop parsefromfile_throughstring() as it does not serve a good use
case, if still needed, it can be easily constructed by the user.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-20 18:26:08 +02:00
722fec83b3
Implement native ACL parsing
Instead of parsing a string representation, parse the native ACL entries
to construct the ACL mapping. This should yield better reliability.
Keep the existing logic in a renamed function, as it might still be useful
to parse existing string representations.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-18 20:43:08 +02:00
4a2fb83885
Add isort script
Easier isorting following the custom ruff linting rules.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-17 23:57:00 +02:00
18c3fefd1b
Implement ACL building/writing
Add basic functionality for writing ACLs with user and group permissions
to a file.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-17 23:56:46 +02:00
926b7e2c84
Deduplicate data in test matrix YAML
Avoid repetitive definitions by utilizing anchors.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-17 00:50:41 +02:00
1db59c0e61
Improve test matrix
Simplify YAML structure and parsing by removing the superfluous list
layer.
Add additional matrix entries to cover more user ACL constellations.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-17 00:40:49 +02:00
446b519e5d
Correct execute bit in map
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-17 00:35:16 +02:00
7fe8afba38
Move test parameters to YAML
The large amount of test data can be managed more easily if it is
contained in a separate file instead of being in the test code.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-17 00:19:56 +02:00
10a3123305
Enhance test suite
Map input ACLs for setfacl with expected pyacl output to allow for
an easily expandable test matrix.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 18:43:10 +02:00
6f05367ae6
Test in container
Avoid the need for specific test users on ones main system.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 16:41:55 +02:00
48b54bbd71
Improve parsing
To make the logic more resilient towards potential errors or future
output changes, not only consider the string index but also validate
it against a set of expected positions.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 16:14:25 +02:00
3f58651401
Functions
Remove superfluous "acl_" prefix from function names, the module
is already called "acl".
Replace hardcoded test path with functions to parse a given file.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 04:12:08 +02:00
d48c773cb4
Test basics
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 03:50:02 +02:00
b9bf679028
Add ruff linter configuration
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 03:49:35 +02:00
031593d470
Formatting
For a better code style:
- consistent trailing commas
- use constant instead of repeated "magic" values

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 03:47:31 +02:00
191c0fac6a
Basics
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 02:55:05 +02:00
00cd5f9c94
Initial commit
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-09-16 02:46:15 +02:00