mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-18 14:27:17 +02:00
Settings has six tabs: General, API keys, Proxies, Notifications, AI and Users. Each tab is one card whose controls save on change; list tabs are tables with a row menu and their Add action in the tab row. A non-admin sees General and AI, read-only. Out-of-band testing is the Callback server sheet on the Arsenal Nuclei tab, with a Need a callback count that filters the library to the same rows. Bounty Hub settings are a sheet on the Bounty Hub page. The old settings routes redirect to both. - API keys store the last test result on the row and clear it when the key changes. Providers report whether a test exists. The usage count is gone: only ViewDNS ever incremented it. - Notification channels store the last delivery, written by the notifier on its own connection. A channel offers the seven event types the product emits, program changes on by default, and levels named All events, Warning and critical, Critical only. - A default proxy applies to a scan launched without a context and is preselected for new contexts. A pool hands each scan one endpoint, proxy URLs bracket IPv6 hosts, and deleting a proxy clears it from its contexts. - Users can be added with a role, disabled and promoted. An account cannot change itself, and one that owns records answers 409. - Retention windows are validated and include keep forever. The instance name cannot be blank and names every page title. - The AI list drops the two switches nothing read; each feature states what it sends. The out-of-band Off help says the checks are skipped. Connectors, Bounty Hub and Remote control lose their extra page padding. Migration 5d2e9a8c1b47 adds the test and delivery columns and drops proxies.mode. Claude-Session: https://claude.ai/code/session_01RVAHQxZ7JAkoEiTCDiHYue
60 lines
1.4 KiB
Python
60 lines
1.4 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import Column
|
|
from sqlalchemy.types import JSON
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
from shared.utils.datetime import utc_now
|
|
|
|
|
|
class UserBase(SQLModel):
|
|
email: str = Field(unique=True, index=True, max_length=255)
|
|
username: str = Field(unique=True, index=True, max_length=50)
|
|
is_active: bool = Field(default=True)
|
|
is_superuser: bool = Field(default=False)
|
|
|
|
|
|
class User(UserBase, table=True):
|
|
__tablename__ = "users"
|
|
|
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
hashed_password: str
|
|
totp_secret_encrypted: str | None = Field(default=None)
|
|
totp_enabled: bool = Field(default=False)
|
|
totp_backup_codes: list | None = Field(
|
|
default=None, sa_column=Column(JSON, nullable=True)
|
|
)
|
|
created_at: datetime = Field(default_factory=utc_now)
|
|
updated_at: datetime | None = Field(default=None)
|
|
|
|
|
|
class UserCreate(SQLModel):
|
|
email: str
|
|
username: str
|
|
password: str
|
|
|
|
|
|
class UserAdminCreate(SQLModel):
|
|
email: str
|
|
username: str
|
|
password: str
|
|
is_superuser: bool = False
|
|
|
|
|
|
class UserAdminUpdate(SQLModel):
|
|
is_active: bool | None = None
|
|
is_superuser: bool | None = None
|
|
|
|
|
|
class UserRead(UserBase):
|
|
id: uuid.UUID
|
|
totp_enabled: bool = False
|
|
created_at: datetime
|
|
updated_at: datetime | None = None
|
|
|
|
|
|
class UserSummary(SQLModel):
|
|
id: uuid.UUID
|
|
username: str
|