Artifex/control_plane/secrets/models.py
2026-08-15 13:50:24 +07:00

31 lines
1.3 KiB
Python

from __future__ import annotations
from django.db import models
from control_plane.common import TimestampedModel
class SecretMetadata(TimestampedModel):
name = models.CharField(max_length=200, unique=True)
secret_type = models.CharField(max_length=80)
encrypted_reference = models.TextField()
description = models.TextField(blank=True)
is_active = models.BooleanField(default=True)
class SecretGrant(TimestampedModel):
secret = models.ForeignKey(SecretMetadata, on_delete=models.CASCADE, related_name="grants")
project = models.ForeignKey("projects.Project", on_delete=models.CASCADE, null=True, blank=True)
capability = models.CharField(max_length=120)
tool_name = models.CharField(max_length=120, blank=True)
is_active = models.BooleanField(default=True)
class SecretAccessAudit(TimestampedModel):
secret = models.ForeignKey(SecretMetadata, on_delete=models.PROTECT, related_name="access_audits")
project = models.ForeignKey("projects.Project", on_delete=models.SET_NULL, null=True, blank=True)
capability = models.CharField(max_length=120)
tool_name = models.CharField(max_length=120, blank=True)
actor = models.CharField(max_length=120)
granted = models.BooleanField(default=False)
reason = models.TextField(blank=True)