tba-storage-authorization-policy 0.4.0.dev2__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.
- tba_storage_authorization_policy-0.4.0.dev2/PKG-INFO +22 -0
- tba_storage_authorization_policy-0.4.0.dev2/README.md +3 -0
- tba_storage_authorization_policy-0.4.0.dev2/pyproject.toml +20 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/__init__.py +7 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/component.toml +137 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/manifest.py +9 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/migrations/__init__.py +0 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/migrations/versions/0ef0b038_e979_5ba7_b874_d36093292702_initial_schema.py +23 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/migrations/versions/5b573a6c_8268_5af3_a505_ea2c8a7c9dcc_normalized_platform_iam.py +47 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/migrations/versions/__init__.py +0 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/py.typed +0 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/__init__.py +45 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/attribute_policy/__init__.py +9 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/attribute_policy/_table.py +40 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/authorization_invariant/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/authorization_invariant/_table.py +34 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/delegated_admin_scope/__init__.py +9 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/delegated_admin_scope/_table.py +34 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/invariant_evaluation/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/invariant_evaluation/_table.py +29 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/invariant_violation/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/invariant_violation/_table.py +27 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/normalized.py +83 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy/_table.py +30 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_condition/__init__.py +9 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_condition/_table.py +21 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_set/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_set/_table.py +33 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_set_member/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_set_member/_table.py +32 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_target/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_target/_table.py +36 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_version/__init__.py +5 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/policy_version/_table.py +35 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/role/__init__.py +9 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/role/_table.py +22 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/tenant_membership/__init__.py +9 -0
- tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/tenant_membership/_table.py +28 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-storage-authorization-policy
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Owned authorization-policy identity database tables and migrations.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10,<3.15
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Requires-Dist: tba-primitives-identity[storage] (>=0.4.0.dev2)
|
|
15
|
+
Requires-Dist: tigrbl (>=0.4.4.dev1,<0.5)
|
|
16
|
+
Requires-Dist: tigrbl-migrations (>=0.4.5.dev4)
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# tba-storage-authorization-policy
|
|
20
|
+
|
|
21
|
+
Owns the `tigrbl.identity.storage.authorization-policy` schema component.
|
|
22
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tba-storage-authorization-policy"
|
|
3
|
+
version = "0.4.0.dev2"
|
|
4
|
+
description = "Owned authorization-policy identity database tables and migrations."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<3.15"
|
|
7
|
+
license = { text = "Apache-2.0" }
|
|
8
|
+
dependencies = [
|
|
9
|
+
"tigrbl>=0.4.4.dev1,<0.5",
|
|
10
|
+
"tigrbl-migrations>=0.4.5.dev4",
|
|
11
|
+
"tba-primitives-identity[storage]>=0.4.0.dev2",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["poetry-core>=1.0.0"]
|
|
16
|
+
build-backend = "poetry.core.masonry.api"
|
|
17
|
+
|
|
18
|
+
[tool.poetry]
|
|
19
|
+
packages = [{ include = "tba_storage_authorization_policy", from = "src" }]
|
|
20
|
+
include = ["src/tba_storage_authorization_policy/component.toml"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Standalone identity storage component."""
|
|
2
|
+
|
|
3
|
+
from .manifest import MANIFEST, load_manifest
|
|
4
|
+
from .tables import * # noqa: F401,F403
|
|
5
|
+
from .tables import TABLE_MODEL_BY_NAME, TABLE_MODEL_BY_TABLENAME, TABLE_MODELS
|
|
6
|
+
|
|
7
|
+
__all__ = ["MANIFEST", "load_manifest", "TABLE_MODELS", "TABLE_MODEL_BY_NAME", "TABLE_MODEL_BY_TABLENAME"] + [model.__name__ for model in TABLE_MODELS]
|
tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/component.toml
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
manifest_version = "1.1.0"
|
|
2
|
+
|
|
3
|
+
[component]
|
|
4
|
+
id = "tigrbl.identity.storage.authorization-policy"
|
|
5
|
+
distribution = "tba-storage-authorization-policy"
|
|
6
|
+
import_root = "tba_storage_authorization_policy"
|
|
7
|
+
|
|
8
|
+
[schema]
|
|
9
|
+
contract = "1.1.0"
|
|
10
|
+
migration_head = "5b573a6c-8268-5af3-a505-ea2c8a7c9dcc"
|
|
11
|
+
migrations_package = "tba_storage_authorization_policy.migrations.versions"
|
|
12
|
+
|
|
13
|
+
[[schema.objects]]
|
|
14
|
+
id = "tigrbl.identity.storage.authorization-policy:table:tenant_memberships"
|
|
15
|
+
kind = "table"
|
|
16
|
+
physical_name = "authn.tenant_memberships"
|
|
17
|
+
model = "tba_storage_authorization_policy.tables:TenantMembership"
|
|
18
|
+
|
|
19
|
+
[[schema.objects]]
|
|
20
|
+
id = "tigrbl.identity.storage.authorization-policy:table:roles"
|
|
21
|
+
kind = "table"
|
|
22
|
+
physical_name = "authn.roles"
|
|
23
|
+
model = "tba_storage_authorization_policy.tables:Role"
|
|
24
|
+
|
|
25
|
+
[[schema.objects]]
|
|
26
|
+
id = "tigrbl.identity.storage.authorization-policy:table:attribute_policies"
|
|
27
|
+
kind = "table"
|
|
28
|
+
physical_name = "authn.attribute_policies"
|
|
29
|
+
model = "tba_storage_authorization_policy.tables:AttributePolicy"
|
|
30
|
+
|
|
31
|
+
[[schema.objects]]
|
|
32
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_conditions"
|
|
33
|
+
kind = "table"
|
|
34
|
+
physical_name = "authn.policy_conditions"
|
|
35
|
+
model = "tba_storage_authorization_policy.tables:PolicyCondition"
|
|
36
|
+
|
|
37
|
+
[[schema.objects]]
|
|
38
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policies"
|
|
39
|
+
kind = "table"
|
|
40
|
+
physical_name = "authn.policies"
|
|
41
|
+
model = "tba_storage_authorization_policy.tables:Policy"
|
|
42
|
+
|
|
43
|
+
[[schema.objects]]
|
|
44
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_versions"
|
|
45
|
+
kind = "table"
|
|
46
|
+
physical_name = "authn.policy_versions"
|
|
47
|
+
model = "tba_storage_authorization_policy.tables:PolicyVersion"
|
|
48
|
+
|
|
49
|
+
[[schema.objects]]
|
|
50
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_sets"
|
|
51
|
+
kind = "table"
|
|
52
|
+
physical_name = "authn.policy_sets"
|
|
53
|
+
model = "tba_storage_authorization_policy.tables:PolicySet"
|
|
54
|
+
|
|
55
|
+
[[schema.objects]]
|
|
56
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_set_members"
|
|
57
|
+
kind = "table"
|
|
58
|
+
physical_name = "authn.policy_set_members"
|
|
59
|
+
model = "tba_storage_authorization_policy.tables:PolicySetMember"
|
|
60
|
+
|
|
61
|
+
[[schema.objects]]
|
|
62
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_targets"
|
|
63
|
+
kind = "table"
|
|
64
|
+
physical_name = "authn.policy_targets"
|
|
65
|
+
model = "tba_storage_authorization_policy.tables:PolicyTarget"
|
|
66
|
+
|
|
67
|
+
[[schema.objects]]
|
|
68
|
+
id = "tigrbl.identity.storage.authorization-policy:table:delegated_admin_scopes"
|
|
69
|
+
kind = "table"
|
|
70
|
+
physical_name = "authn.delegated_admin_scopes"
|
|
71
|
+
model = "tba_storage_authorization_policy.tables:DelegatedAdminScope"
|
|
72
|
+
|
|
73
|
+
[[schema.objects]]
|
|
74
|
+
id = "tigrbl.identity.storage.authorization-policy:table:authorization_invariants"
|
|
75
|
+
kind = "table"
|
|
76
|
+
physical_name = "authn.authorization_invariants"
|
|
77
|
+
model = "tba_storage_authorization_policy.tables:AuthorizationInvariant"
|
|
78
|
+
|
|
79
|
+
[[schema.objects]]
|
|
80
|
+
id = "tigrbl.identity.storage.authorization-policy:table:invariant_evaluations"
|
|
81
|
+
kind = "table"
|
|
82
|
+
physical_name = "authn.invariant_evaluations"
|
|
83
|
+
model = "tba_storage_authorization_policy.tables:InvariantEvaluation"
|
|
84
|
+
|
|
85
|
+
[[schema.objects]]
|
|
86
|
+
id = "tigrbl.identity.storage.authorization-policy:table:invariant_violations"
|
|
87
|
+
kind = "table"
|
|
88
|
+
physical_name = "authn.invariant_violations"
|
|
89
|
+
model = "tba_storage_authorization_policy.tables:InvariantViolation"
|
|
90
|
+
|
|
91
|
+
[[schema.objects]]
|
|
92
|
+
id = "tigrbl.identity.storage.authorization-policy:table:authorization_resource_types"
|
|
93
|
+
kind = "table"
|
|
94
|
+
physical_name = "authn.authorization_resource_types"
|
|
95
|
+
model = "tba_storage_authorization_policy.tables:AuthorizationResourceType"
|
|
96
|
+
|
|
97
|
+
[[schema.objects]]
|
|
98
|
+
id = "tigrbl.identity.storage.authorization-policy:table:authorization_actions"
|
|
99
|
+
kind = "table"
|
|
100
|
+
physical_name = "authn.authorization_actions"
|
|
101
|
+
model = "tba_storage_authorization_policy.tables:AuthorizationAction"
|
|
102
|
+
|
|
103
|
+
[[schema.objects]]
|
|
104
|
+
id = "tigrbl.identity.storage.authorization-policy:table:authorization_groups"
|
|
105
|
+
kind = "table"
|
|
106
|
+
physical_name = "authn.authorization_groups"
|
|
107
|
+
model = "tba_storage_authorization_policy.tables:AuthorizationGroup"
|
|
108
|
+
|
|
109
|
+
[[schema.objects]]
|
|
110
|
+
id = "tigrbl.identity.storage.authorization-policy:table:authorization_group_memberships"
|
|
111
|
+
kind = "table"
|
|
112
|
+
physical_name = "authn.authorization_group_memberships"
|
|
113
|
+
model = "tba_storage_authorization_policy.tables:AuthorizationGroupMembership"
|
|
114
|
+
|
|
115
|
+
[[schema.objects]]
|
|
116
|
+
id = "tigrbl.identity.storage.authorization-policy:table:role_permissions"
|
|
117
|
+
kind = "table"
|
|
118
|
+
physical_name = "authn.role_permissions"
|
|
119
|
+
model = "tba_storage_authorization_policy.tables:RolePermission"
|
|
120
|
+
|
|
121
|
+
[[schema.objects]]
|
|
122
|
+
id = "tigrbl.identity.storage.authorization-policy:table:role_grants"
|
|
123
|
+
kind = "table"
|
|
124
|
+
physical_name = "authn.role_grants"
|
|
125
|
+
model = "tba_storage_authorization_policy.tables:RoleGrant"
|
|
126
|
+
|
|
127
|
+
[[schema.objects]]
|
|
128
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_approvals"
|
|
129
|
+
kind = "table"
|
|
130
|
+
physical_name = "authn.policy_approvals"
|
|
131
|
+
model = "tba_storage_authorization_policy.tables:PolicyApproval"
|
|
132
|
+
|
|
133
|
+
[[schema.objects]]
|
|
134
|
+
id = "tigrbl.identity.storage.authorization-policy:table:policy_publications"
|
|
135
|
+
kind = "table"
|
|
136
|
+
physical_name = "authn.policy_publications"
|
|
137
|
+
model = "tba_storage_authorization_policy.tables:PolicyPublication"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Installed component manifest access."""
|
|
2
|
+
from importlib.resources import as_file, files
|
|
3
|
+
from tigrbl_migrations import StorageManifest
|
|
4
|
+
|
|
5
|
+
def load_manifest() -> StorageManifest:
|
|
6
|
+
with as_file(files(__package__).joinpath("component.toml")) as path:
|
|
7
|
+
return StorageManifest.from_toml(path)
|
|
8
|
+
|
|
9
|
+
MANIFEST = load_manifest()
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Initial owned schema for tigrbl.identity.storage.authorization-policy."""
|
|
2
|
+
from tigrbl_migrations import Migration
|
|
3
|
+
from tba_storage_authorization_policy.tables import TABLE_MODELS
|
|
4
|
+
|
|
5
|
+
REVISION = "0ef0b038-e979-5ba7-b874-d36093292702"
|
|
6
|
+
|
|
7
|
+
def upgrade(connection):
|
|
8
|
+
for model in TABLE_MODELS:
|
|
9
|
+
model.__table__.create(bind=connection, checkfirst=True)
|
|
10
|
+
|
|
11
|
+
def downgrade(connection):
|
|
12
|
+
for model in reversed(TABLE_MODELS):
|
|
13
|
+
model.__table__.drop(bind=connection, checkfirst=True)
|
|
14
|
+
|
|
15
|
+
MIGRATION = Migration(
|
|
16
|
+
component="tigrbl.identity.storage.authorization-policy",
|
|
17
|
+
revision=REVISION,
|
|
18
|
+
parents=(),
|
|
19
|
+
kind="standard",
|
|
20
|
+
reversible=True,
|
|
21
|
+
upgrade=upgrade,
|
|
22
|
+
downgrade=downgrade,
|
|
23
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Add normalized RBAC and immutable policy publication records."""
|
|
2
|
+
|
|
3
|
+
from tigrbl_migrations import Migration
|
|
4
|
+
from tba_storage_authorization_policy.tables import (
|
|
5
|
+
AuthorizationAction,
|
|
6
|
+
AuthorizationGroup,
|
|
7
|
+
AuthorizationGroupMembership,
|
|
8
|
+
AuthorizationResourceType,
|
|
9
|
+
PolicyApproval,
|
|
10
|
+
PolicyPublication,
|
|
11
|
+
RoleGrant,
|
|
12
|
+
RolePermission,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
REVISION = "5b573a6c-8268-5af3-a505-ea2c8a7c9dcc"
|
|
16
|
+
PARENT = "0ef0b038-e979-5ba7-b874-d36093292702"
|
|
17
|
+
MODELS = (
|
|
18
|
+
AuthorizationResourceType,
|
|
19
|
+
AuthorizationAction,
|
|
20
|
+
AuthorizationGroup,
|
|
21
|
+
AuthorizationGroupMembership,
|
|
22
|
+
RolePermission,
|
|
23
|
+
RoleGrant,
|
|
24
|
+
PolicyApproval,
|
|
25
|
+
PolicyPublication,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def upgrade(connection):
|
|
30
|
+
for model in MODELS:
|
|
31
|
+
model.__table__.create(bind=connection, checkfirst=True)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def downgrade(connection):
|
|
35
|
+
for model in reversed(MODELS):
|
|
36
|
+
model.__table__.drop(bind=connection, checkfirst=True)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
MIGRATION = Migration(
|
|
40
|
+
component="tigrbl.identity.storage.authorization-policy",
|
|
41
|
+
revision=REVISION,
|
|
42
|
+
parents=(PARENT,),
|
|
43
|
+
kind="standard",
|
|
44
|
+
reversible=True,
|
|
45
|
+
upgrade=upgrade,
|
|
46
|
+
downgrade=downgrade,
|
|
47
|
+
)
|
|
File without changes
|
|
File without changes
|
tba_storage_authorization_policy-0.4.0.dev2/src/tba_storage_authorization_policy/tables/__init__.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Owned mapped-table inventory."""
|
|
2
|
+
|
|
3
|
+
from .attribute_policy import AttributePolicy
|
|
4
|
+
from .authorization_invariant import AuthorizationInvariant
|
|
5
|
+
from .delegated_admin_scope import DelegatedAdminScope
|
|
6
|
+
from .invariant_evaluation import InvariantEvaluation
|
|
7
|
+
from .invariant_violation import InvariantViolation
|
|
8
|
+
from .policy import Policy
|
|
9
|
+
from .policy_condition import PolicyCondition
|
|
10
|
+
from .policy_set import PolicySet
|
|
11
|
+
from .policy_set_member import PolicySetMember
|
|
12
|
+
from .policy_target import PolicyTarget
|
|
13
|
+
from .policy_version import PolicyVersion
|
|
14
|
+
from .role import Role
|
|
15
|
+
from .tenant_membership import TenantMembership
|
|
16
|
+
from .normalized import AuthorizationAction, AuthorizationGroup, AuthorizationGroupMembership, AuthorizationResourceType, PolicyApproval, PolicyPublication, RoleGrant, RolePermission
|
|
17
|
+
|
|
18
|
+
TABLE_MODELS = (
|
|
19
|
+
TenantMembership,
|
|
20
|
+
Role,
|
|
21
|
+
AttributePolicy,
|
|
22
|
+
PolicyCondition,
|
|
23
|
+
Policy,
|
|
24
|
+
PolicyVersion,
|
|
25
|
+
PolicySet,
|
|
26
|
+
PolicySetMember,
|
|
27
|
+
PolicyTarget,
|
|
28
|
+
DelegatedAdminScope,
|
|
29
|
+
AuthorizationInvariant,
|
|
30
|
+
InvariantEvaluation,
|
|
31
|
+
InvariantViolation,
|
|
32
|
+
AuthorizationResourceType,
|
|
33
|
+
AuthorizationAction,
|
|
34
|
+
AuthorizationGroup,
|
|
35
|
+
AuthorizationGroupMembership,
|
|
36
|
+
RolePermission,
|
|
37
|
+
RoleGrant,
|
|
38
|
+
PolicyApproval,
|
|
39
|
+
PolicyPublication,
|
|
40
|
+
)
|
|
41
|
+
TABLE_MODEL_BY_NAME = {model.__name__: model for model in TABLE_MODELS}
|
|
42
|
+
TABLE_MODEL_BY_TABLENAME = {model.__tablename__: model for model in TABLE_MODELS}
|
|
43
|
+
__all__ = [model.__name__ for model in TABLE_MODELS] + [
|
|
44
|
+
"TABLE_MODELS", "TABLE_MODEL_BY_NAME", "TABLE_MODEL_BY_TABLENAME",
|
|
45
|
+
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Durable ABAC policy definitions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from tba_primitives_identity.orm import (
|
|
7
|
+
RestOltpTable,
|
|
8
|
+
GUIDPk,
|
|
9
|
+
JSON,
|
|
10
|
+
Mapped,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AttributePolicy(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "attribute_policies"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
name: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
tenant_id: Mapped[str | None] = acol(
|
|
24
|
+
storage=S(String(255), nullable=True, index=True)
|
|
25
|
+
)
|
|
26
|
+
client_id: Mapped[str | None] = acol(
|
|
27
|
+
storage=S(String(255), nullable=True, index=True)
|
|
28
|
+
)
|
|
29
|
+
permission: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
30
|
+
effect: Mapped[str] = acol(
|
|
31
|
+
storage=S(String(32), nullable=False, default="allow", index=True)
|
|
32
|
+
)
|
|
33
|
+
required_attributes: Mapped[dict] = acol(
|
|
34
|
+
storage=S(JSON, nullable=False, default=dict)
|
|
35
|
+
)
|
|
36
|
+
status: Mapped[str] = acol(
|
|
37
|
+
storage=S(String(32), nullable=False, default="active", index=True)
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = ["AttributePolicy"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Durable authorization invariant definitions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
Boolean,
|
|
7
|
+
GUIDPk,
|
|
8
|
+
JSON,
|
|
9
|
+
Mapped,
|
|
10
|
+
RestOltpTable,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AuthorizationInvariant(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "authorization_invariants"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
invariant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, unique=True, index=True))
|
|
23
|
+
title: Mapped[str] = acol(storage=S(String(255), nullable=False))
|
|
24
|
+
property_family: Mapped[str] = acol(storage=S(String(128), nullable=False, index=True))
|
|
25
|
+
statement: Mapped[str] = acol(storage=S(String(2000), nullable=False))
|
|
26
|
+
verification_method: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
|
|
27
|
+
severity: Mapped[str] = acol(storage=S(String(64), nullable=False, default="error", index=True))
|
|
28
|
+
enabled: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=True, index=True))
|
|
29
|
+
feature_ids: Mapped[dict] = acol(storage=S(JSON, nullable=False, default=dict))
|
|
30
|
+
spec_ids: Mapped[dict] = acol(storage=S(JSON, nullable=False, default=dict))
|
|
31
|
+
tags: Mapped[dict] = acol(storage=S(JSON, nullable=False, default=dict))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
__all__ = ["AuthorizationInvariant"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Durable delegated administration scopes."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from tba_primitives_identity.orm import (
|
|
7
|
+
RestOltpTable,
|
|
8
|
+
GUIDPk,
|
|
9
|
+
JSON,
|
|
10
|
+
Mapped,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class DelegatedAdminScope(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "delegated_admin_scopes"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
subject: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
tenant_ids: Mapped[list] = acol(storage=S(JSON, nullable=False, default=list))
|
|
24
|
+
permissions: Mapped[list] = acol(storage=S(JSON, nullable=False, default=list))
|
|
25
|
+
visible_client_fields: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
26
|
+
mutable_client_fields: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
27
|
+
service_identity_permissions: Mapped[list | None] = acol(
|
|
28
|
+
storage=S(JSON, nullable=True)
|
|
29
|
+
)
|
|
30
|
+
status: Mapped[str] = acol(
|
|
31
|
+
storage=S(String(32), nullable=False, default="active", index=True)
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
__all__ = ["DelegatedAdminScope"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Durable authorization invariant evaluation records."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
Boolean,
|
|
7
|
+
GUIDPk,
|
|
8
|
+
JSON,
|
|
9
|
+
Mapped,
|
|
10
|
+
RestOltpTable,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class InvariantEvaluation(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "invariant_evaluations"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
invariant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
passed: Mapped[bool] = acol(storage=S(Boolean, nullable=False, index=True))
|
|
24
|
+
message: Mapped[str] = acol(storage=S(String(2000), nullable=False))
|
|
25
|
+
evaluated_at: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
|
|
26
|
+
evidence: Mapped[dict] = acol(storage=S(JSON, nullable=False, default=dict))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = ["InvariantEvaluation"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Durable authorization invariant violation records."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
GUIDPk,
|
|
7
|
+
JSON,
|
|
8
|
+
Mapped,
|
|
9
|
+
RestOltpTable,
|
|
10
|
+
S,
|
|
11
|
+
String,
|
|
12
|
+
Timestamped,
|
|
13
|
+
acol,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InvariantViolation(RestOltpTable, GUIDPk, Timestamped):
|
|
18
|
+
__tablename__ = "invariant_violations"
|
|
19
|
+
__table_args__ = ({"schema": "authn"},)
|
|
20
|
+
|
|
21
|
+
invariant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
22
|
+
severity: Mapped[str] = acol(storage=S(String(64), nullable=False, index=True))
|
|
23
|
+
message: Mapped[str] = acol(storage=S(String(2000), nullable=False))
|
|
24
|
+
evidence: Mapped[dict] = acol(storage=S(JSON, nullable=False, default=dict))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = ["InvariantViolation"]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Normalized RBAC, publication, and access-governance storage models."""
|
|
2
|
+
|
|
3
|
+
from tba_primitives_identity.orm import Boolean, GUIDPk, JSON, Mapped, RestOltpTable, S, String, Timestamped, acol
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AuthorizationResourceType(RestOltpTable, GUIDPk, Timestamped):
|
|
7
|
+
__tablename__ = "authorization_resource_types"
|
|
8
|
+
__table_args__ = ({"schema": "authn"},)
|
|
9
|
+
key: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
10
|
+
tenant_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
11
|
+
|
|
12
|
+
class AuthorizationAction(RestOltpTable, GUIDPk, Timestamped):
|
|
13
|
+
__tablename__ = "authorization_actions"
|
|
14
|
+
__table_args__ = ({"schema": "authn"},)
|
|
15
|
+
key: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
16
|
+
resource_type: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
17
|
+
required_acr: Mapped[str | None] = acol(storage=S(String(255), nullable=True))
|
|
18
|
+
|
|
19
|
+
class AuthorizationGroup(RestOltpTable, GUIDPk, Timestamped):
|
|
20
|
+
__tablename__ = "authorization_groups"
|
|
21
|
+
__table_args__ = ({"schema": "authn"},)
|
|
22
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
name: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
24
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
25
|
+
|
|
26
|
+
class AuthorizationGroupMembership(RestOltpTable, GUIDPk, Timestamped):
|
|
27
|
+
__tablename__ = "authorization_group_memberships"
|
|
28
|
+
__table_args__ = ({"schema": "authn"},)
|
|
29
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
30
|
+
group_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
31
|
+
principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
32
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
33
|
+
|
|
34
|
+
class RolePermission(RestOltpTable, GUIDPk, Timestamped):
|
|
35
|
+
__tablename__ = "role_permissions"
|
|
36
|
+
__table_args__ = ({"schema": "authn"},)
|
|
37
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
38
|
+
role_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
39
|
+
action_key: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
40
|
+
effect: Mapped[str] = acol(storage=S(String(16), nullable=False, default="allow", index=True))
|
|
41
|
+
|
|
42
|
+
class RoleGrant(RestOltpTable, GUIDPk, Timestamped):
|
|
43
|
+
__tablename__ = "role_grants"
|
|
44
|
+
__table_args__ = ({"schema": "authn"},)
|
|
45
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
46
|
+
principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
47
|
+
principal_type: Mapped[str] = acol(storage=S(String(32), nullable=False, index=True))
|
|
48
|
+
role_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
49
|
+
resource_type: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
50
|
+
resource_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
51
|
+
valid_from: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
|
|
52
|
+
expires_at: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
|
|
53
|
+
revoked_at: Mapped[str | None] = acol(storage=S(String(64), nullable=True))
|
|
54
|
+
conditions: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
55
|
+
|
|
56
|
+
class PolicyApproval(RestOltpTable, GUIDPk, Timestamped):
|
|
57
|
+
__tablename__ = "policy_approvals"
|
|
58
|
+
__table_args__ = ({"schema": "authn"},)
|
|
59
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
60
|
+
policy_version_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
61
|
+
approver_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
62
|
+
decision: Mapped[str] = acol(storage=S(String(32), nullable=False, index=True))
|
|
63
|
+
reason: Mapped[str | None] = acol(storage=S(String(2000), nullable=True))
|
|
64
|
+
|
|
65
|
+
class PolicyPublication(RestOltpTable, GUIDPk, Timestamped):
|
|
66
|
+
__tablename__ = "policy_publications"
|
|
67
|
+
__table_args__ = ({"schema": "authn"},)
|
|
68
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
69
|
+
policy_version_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
70
|
+
manifest_hash: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
71
|
+
active: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=True, index=True))
|
|
72
|
+
supersedes_publication_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True))
|
|
73
|
+
|
|
74
|
+
__all__ = [
|
|
75
|
+
"AuthorizationResourceType",
|
|
76
|
+
"AuthorizationAction",
|
|
77
|
+
"AuthorizationGroup",
|
|
78
|
+
"AuthorizationGroupMembership",
|
|
79
|
+
"RolePermission",
|
|
80
|
+
"RoleGrant",
|
|
81
|
+
"PolicyApproval",
|
|
82
|
+
"PolicyPublication",
|
|
83
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Durable policy definition records for PAP and PRP surfaces."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
GUIDPk,
|
|
7
|
+
JSON,
|
|
8
|
+
Mapped,
|
|
9
|
+
RestOltpTable,
|
|
10
|
+
S,
|
|
11
|
+
String,
|
|
12
|
+
Timestamped,
|
|
13
|
+
acol,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Policy(RestOltpTable, GUIDPk, Timestamped):
|
|
18
|
+
__tablename__ = "policies"
|
|
19
|
+
__table_args__ = ({"schema": "authn"},)
|
|
20
|
+
|
|
21
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
22
|
+
name: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
language: Mapped[str] = acol(storage=S(String(128), nullable=False, default="tba-conditions/v1", index=True))
|
|
24
|
+
description: Mapped[str | None] = acol(storage=S(String(1000), nullable=True))
|
|
25
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="draft", index=True))
|
|
26
|
+
active_version_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
27
|
+
policy_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = ["Policy"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Durable dynamic policy conditions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from tba_primitives_identity.orm import RestOltpTable, GUIDPk, JSON, Mapped, S, String, Timestamped, acol
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PolicyCondition(RestOltpTable, GUIDPk, Timestamped):
|
|
11
|
+
__tablename__ = "policy_conditions"
|
|
12
|
+
__table_args__ = ({"schema": "authn"},)
|
|
13
|
+
|
|
14
|
+
policy_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
15
|
+
field_name: Mapped[str] = acol(storage=S(String(255), nullable=False))
|
|
16
|
+
operator: Mapped[str] = acol(storage=S(String(64), nullable=False))
|
|
17
|
+
expected: Mapped[dict | list | str | int | float | bool | None] = acol(storage=S(JSON, nullable=True))
|
|
18
|
+
condition_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = ["PolicyCondition"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Durable policy set records for XACML-style policy grouping."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
GUIDPk,
|
|
7
|
+
Integer,
|
|
8
|
+
JSON,
|
|
9
|
+
Mapped,
|
|
10
|
+
RestOltpTable,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PolicySet(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "policy_sets"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
name: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
24
|
+
description: Mapped[str | None] = acol(storage=S(String(1000), nullable=True))
|
|
25
|
+
combining_algorithm: Mapped[str] = acol(
|
|
26
|
+
storage=S(String(128), nullable=False, default="deny_overrides", index=True)
|
|
27
|
+
)
|
|
28
|
+
priority: Mapped[int] = acol(storage=S(Integer, nullable=False, default=0, index=True))
|
|
29
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
30
|
+
policy_set_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__all__ = ["PolicySet"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Durable policy set member records."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
GUIDPk,
|
|
7
|
+
Integer,
|
|
8
|
+
JSON,
|
|
9
|
+
Mapped,
|
|
10
|
+
RestOltpTable,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PolicySetMember(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "policy_set_members"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
policy_set_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
24
|
+
member_kind: Mapped[str] = acol(storage=S(String(32), nullable=False, index=True))
|
|
25
|
+
member_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
26
|
+
priority: Mapped[int] = acol(storage=S(Integer, nullable=False, default=0, index=True))
|
|
27
|
+
condition_expression: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
28
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
29
|
+
member_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
__all__ = ["PolicySetMember"]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Durable policy target records."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
GUIDPk,
|
|
7
|
+
Integer,
|
|
8
|
+
JSON,
|
|
9
|
+
Mapped,
|
|
10
|
+
RestOltpTable,
|
|
11
|
+
S,
|
|
12
|
+
String,
|
|
13
|
+
Timestamped,
|
|
14
|
+
acol,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PolicyTarget(RestOltpTable, GUIDPk, Timestamped):
|
|
19
|
+
__tablename__ = "policy_targets"
|
|
20
|
+
__table_args__ = ({"schema": "authn"},)
|
|
21
|
+
|
|
22
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
owner_kind: Mapped[str] = acol(storage=S(String(32), nullable=False, index=True))
|
|
24
|
+
owner_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
25
|
+
subject_selector: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
26
|
+
resource_selector: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
27
|
+
action_selector: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
28
|
+
environment_selector: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
29
|
+
scope_selector: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
30
|
+
condition_expression: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
31
|
+
priority: Mapped[int] = acol(storage=S(Integer, nullable=False, default=0, index=True))
|
|
32
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
33
|
+
target_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
__all__ = ["PolicyTarget"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Durable policy version records for PAP and PRP surfaces."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
Boolean,
|
|
7
|
+
GUIDPk,
|
|
8
|
+
Integer,
|
|
9
|
+
JSON,
|
|
10
|
+
Mapped,
|
|
11
|
+
RestOltpTable,
|
|
12
|
+
S,
|
|
13
|
+
String,
|
|
14
|
+
Timestamped,
|
|
15
|
+
acol,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PolicyVersion(RestOltpTable, GUIDPk, Timestamped):
|
|
20
|
+
__tablename__ = "policy_versions"
|
|
21
|
+
__table_args__ = ({"schema": "authn"},)
|
|
22
|
+
|
|
23
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
24
|
+
policy_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
25
|
+
version_number: Mapped[int] = acol(storage=S(Integer, nullable=False, default=1, index=True))
|
|
26
|
+
source: Mapped[str] = acol(storage=S(String(4000), nullable=False))
|
|
27
|
+
source_hash: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
28
|
+
relation: Mapped[str | None] = acol(storage=S(String(255), nullable=True))
|
|
29
|
+
context_equals: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
30
|
+
promoted: Mapped[bool] = acol(storage=S(Boolean, nullable=False, default=False, index=True))
|
|
31
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="draft", index=True))
|
|
32
|
+
version_metadata: Mapped[dict | None] = acol(storage=S(JSON, nullable=True))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
__all__ = ["PolicyVersion"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Durable RBAC role definitions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from tba_primitives_identity.orm import RestOltpTable, GUIDPk, JSON, Mapped, S, String, Timestamped, acol
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Role(RestOltpTable, GUIDPk, Timestamped):
|
|
11
|
+
__tablename__ = "roles"
|
|
12
|
+
__table_args__ = ({"schema": "authn"},)
|
|
13
|
+
|
|
14
|
+
name: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
15
|
+
tenant_id: Mapped[str | None] = acol(storage=S(String(255), nullable=True, index=True))
|
|
16
|
+
permissions: Mapped[list] = acol(storage=S(JSON, nullable=False, default=list))
|
|
17
|
+
denied_permissions: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
18
|
+
inherited_roles: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
19
|
+
status: Mapped[str] = acol(storage=S(String(32), nullable=False, default="active", index=True))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
__all__ = ["Role"]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Durable principal-to-tenant memberships."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_primitives_identity.orm import (
|
|
6
|
+
RestOltpTable,
|
|
7
|
+
GUIDPk,
|
|
8
|
+
JSON,
|
|
9
|
+
Mapped,
|
|
10
|
+
S,
|
|
11
|
+
String,
|
|
12
|
+
Timestamped,
|
|
13
|
+
acol,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TenantMembership(RestOltpTable, GUIDPk, Timestamped):
|
|
18
|
+
__tablename__ = "tenant_memberships"
|
|
19
|
+
__table_args__ = ({"schema": "authn"},)
|
|
20
|
+
|
|
21
|
+
tenant_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
22
|
+
principal_id: Mapped[str] = acol(storage=S(String(255), nullable=False, index=True))
|
|
23
|
+
roles: Mapped[list | None] = acol(storage=S(JSON, nullable=True))
|
|
24
|
+
status: Mapped[str] = acol(
|
|
25
|
+
storage=S(String(32), nullable=False, default="active", index=True)
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__all__ = ["TenantMembership"]
|