fluidattacks-core 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fluidattacks_core-1.0.0/PKG-INFO +21 -0
- fluidattacks_core-1.0.0/README.md +6 -0
- fluidattacks_core-1.0.0/fluidattacks_core/__init__.py +0 -0
- fluidattacks_core-1.0.0/fluidattacks_core/authz/__init__.py +0 -0
- fluidattacks_core-1.0.0/fluidattacks_core/authz/py.typed +0 -0
- fluidattacks_core-1.0.0/fluidattacks_core/authz/types.py +75 -0
- fluidattacks_core-1.0.0/fluidattacks_core/py.typed +0 -0
- fluidattacks_core-1.0.0/pyproject.toml +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: fluidattacks-core
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Fluid Attacks Core Library
|
|
5
|
+
License: MPL-2.0
|
|
6
|
+
Author: Development
|
|
7
|
+
Author-email: development@fluidattacks.com
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# Fluid Attacks Core Library
|
|
16
|
+
|
|
17
|
+
This library allows you to import the
|
|
18
|
+
Fluid Attacks business logic to any other Python project.
|
|
19
|
+
|
|
20
|
+
This is still an experiment under construction.
|
|
21
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from __future__ import (
|
|
2
|
+
annotations,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
from dataclasses import (
|
|
6
|
+
dataclass,
|
|
7
|
+
)
|
|
8
|
+
from typing import (
|
|
9
|
+
Literal,
|
|
10
|
+
TypedDict,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
AuthzType = Literal[
|
|
14
|
+
"admin",
|
|
15
|
+
"user",
|
|
16
|
+
"organization",
|
|
17
|
+
"group",
|
|
18
|
+
"root",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
AuthzRelation = Literal[
|
|
22
|
+
"admin",
|
|
23
|
+
"parent",
|
|
24
|
+
"customer_manage",
|
|
25
|
+
"customer_write",
|
|
26
|
+
"customer_read",
|
|
27
|
+
"fluid_manage",
|
|
28
|
+
"fluid_write",
|
|
29
|
+
"fluid_read",
|
|
30
|
+
"manage",
|
|
31
|
+
"write",
|
|
32
|
+
"read",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True, kw_only=True)
|
|
37
|
+
class AuthzConditionFluidEmail:
|
|
38
|
+
email: str
|
|
39
|
+
|
|
40
|
+
class _ReturnTypeContext(TypedDict):
|
|
41
|
+
email: str
|
|
42
|
+
|
|
43
|
+
class _ReturnType(TypedDict):
|
|
44
|
+
name: Literal["fluid_email"]
|
|
45
|
+
context: AuthzConditionFluidEmail._ReturnTypeContext
|
|
46
|
+
|
|
47
|
+
def __call__(self) -> _ReturnType:
|
|
48
|
+
return {
|
|
49
|
+
"name": "fluid_email",
|
|
50
|
+
"context": {"email": self.email},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True, kw_only=True)
|
|
55
|
+
class AuthzTuple:
|
|
56
|
+
user_type: AuthzType
|
|
57
|
+
user: str
|
|
58
|
+
relation: AuthzRelation
|
|
59
|
+
object_type: AuthzType
|
|
60
|
+
object: str
|
|
61
|
+
condition: AuthzConditionFluidEmail | None = None
|
|
62
|
+
|
|
63
|
+
class _ReturnType(TypedDict):
|
|
64
|
+
user: str
|
|
65
|
+
relation: AuthzRelation
|
|
66
|
+
object: str
|
|
67
|
+
condition: AuthzConditionFluidEmail._ReturnType | None
|
|
68
|
+
|
|
69
|
+
def __call__(self) -> _ReturnType:
|
|
70
|
+
return {
|
|
71
|
+
"user": f"{self.user_type}:{self.user}",
|
|
72
|
+
"relation": self.relation,
|
|
73
|
+
"object": f"{self.object_type}:{self.object}",
|
|
74
|
+
"condition": self.condition() if self.condition else None,
|
|
75
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "fluidattacks-core"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Fluid Attacks Core Library"
|
|
5
|
+
authors = ["Development <development@fluidattacks.com>"]
|
|
6
|
+
license = "MPL-2.0"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "^3.11"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
[build-system]
|
|
14
|
+
requires = ["poetry-core"]
|
|
15
|
+
build-backend = "poetry.core.masonry.api"
|