sprint12+13: zentrale rechte settings page + ABAC engine backend (model, migration 0055, service, routes)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"""Schemas for ABAC entity policies."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class PolicyCreate(BaseModel):
|
||||
name: str = Field(..., min_length=1, max_length=200)
|
||||
entity_type: str = Field(..., min_length=1, max_length=50)
|
||||
principal_type: str = Field(..., pattern="^(user|group|role)$")
|
||||
principal_id: str
|
||||
effect: str = Field("allow", pattern="^(allow|deny)$")
|
||||
conditions: dict[str, Any] | None = None
|
||||
priority: int = 0
|
||||
|
||||
|
||||
class PolicyUpdate(BaseModel):
|
||||
name: str | None = Field(None, min_length=1, max_length=200)
|
||||
entity_type: str | None = Field(None, min_length=1, max_length=50)
|
||||
principal_type: str | None = Field(None, pattern="^(user|group|role)$")
|
||||
principal_id: str | None = None
|
||||
effect: str | None = Field(None, pattern="^(allow|deny)$")
|
||||
conditions: dict[str, Any] | None = None
|
||||
priority: int | None = None
|
||||
enabled: bool | None = None
|
||||
|
||||
|
||||
class PolicyResponse(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
entity_type: str
|
||||
principal_type: str
|
||||
principal_id: str
|
||||
effect: str
|
||||
conditions: dict[str, Any] | None = None
|
||||
priority: int
|
||||
tenant_id: str
|
||||
enabled: bool
|
||||
created_at: str | None = None
|
||||
updated_at: str | None = None
|
||||
Reference in New Issue
Block a user