Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateSlug(name string) string
- func IsValidSlug(slug string) bool
- type AIMode
- type AISettings
- type APISettings
- type BranchSettings
- type BrandingSettings
- type CTEMPointsConfig
- type ComponentWeights
- type ConfigOption
- type CriticalityScoreConfig
- type ExposureMultiplierConfig
- type ExposureScoreConfig
- type FindingImpactConfig
- type GeneralSettings
- type Invitation
- func (i *Invitation) Accept() error
- func (i *Invitation) AcceptedAt() *time.Time
- func (i *Invitation) CreatedAt() time.Time
- func (i *Invitation) Email() string
- func (i *Invitation) ExpiresAt() time.Time
- func (i *Invitation) ID() shared.ID
- func (i *Invitation) InvitedBy() shared.ID
- func (i *Invitation) IsAccepted() bool
- func (i *Invitation) IsExpired() bool
- func (i *Invitation) IsPending() bool
- func (i *Invitation) Role() Role
- func (i *Invitation) RoleIDs() []string
- func (i *Invitation) TenantID() shared.ID
- func (i *Invitation) Token() string
- type LLMProvider
- type MemberInfo
- type MemberSearchFilters
- type MemberSearchResult
- type MemberStats
- type MemberWithUser
- type Membership
- func (m *Membership) CanRead() bool
- func (m *Membership) CanWrite() bool
- func (m *Membership) ID() shared.ID
- func (m *Membership) InvitedBy() *shared.ID
- func (m *Membership) IsAdmin() bool
- func (m *Membership) IsOwner() bool
- func (m *Membership) JoinedAt() time.Time
- func (m *Membership) Role() Role
- func (m *Membership) TenantID() shared.ID
- func (m *Membership) UpdateRole(role Role) error
- func (m *Membership) UserID() shared.ID
- type PentestSettings
- type Plan
- type PlanLimits
- type Repository
- type RiskLevelConfig
- type RiskScoringSettings
- type Role
- func (r Role) CanAssignRole(target Role) bool
- func (r Role) CanDelete() bool
- func (r Role) CanInvite() bool
- func (r Role) CanManageBilling() bool
- func (r Role) CanManageMembers() bool
- func (r Role) CanRead() bool
- func (r Role) CanWrite() bool
- func (r Role) IsValid() bool
- func (r Role) Priority() int
- func (r Role) String() string
- type SecuritySettings
- type Settings
- type SeverityWeightConfig
- type Tenant
- func (t *Tenant) CreatedAt() time.Time
- func (t *Tenant) CreatedBy() string
- func (t *Tenant) Description() string
- func (t *Tenant) GetSetting(key string) (any, bool)
- func (t *Tenant) ID() shared.ID
- func (t *Tenant) LogoURL() string
- func (t *Tenant) Name() string
- func (t *Tenant) Plan() Plan
- func (t *Tenant) SetSetting(key string, value any)
- func (t *Tenant) Settings() map[string]any
- func (t *Tenant) Slug() string
- func (t *Tenant) TypedSettings() Settings
- func (t *Tenant) UpdateAISettings(ai AISettings) error
- func (t *Tenant) UpdateAPISettings(api APISettings) error
- func (t *Tenant) UpdateBranchSettings(bs BranchSettings) error
- func (t *Tenant) UpdateBrandingSettings(branding BrandingSettings) error
- func (t *Tenant) UpdateDescription(description string)
- func (t *Tenant) UpdateGeneralSettings(general GeneralSettings) error
- func (t *Tenant) UpdateLogoURL(logoURL string)
- func (t *Tenant) UpdateName(name string) error
- func (t *Tenant) UpdatePentestSettings(ps PentestSettings) error
- func (t *Tenant) UpdatePlan(_ Plan) error
- func (t *Tenant) UpdateRiskScoringSettings(rs RiskScoringSettings) error
- func (t *Tenant) UpdateSecuritySettings(security SecuritySettings) error
- func (t *Tenant) UpdateSettings(settings Settings) error
- func (t *Tenant) UpdateSlug(slug string) error
- func (t *Tenant) UpdatedAt() time.Time
- type TenantWithRole
- type UserMembership
- type WebhookEvent
Constants ¶
const ( // DefaultInvitationExpiry is the default expiry duration for invitations. DefaultInvitationExpiry = 7 * 24 * time.Hour // 7 days )
Variables ¶
var AllRiskScoringPresets = map[string]RiskScoringSettings{ "legacy": LegacyRiskScoringSettings(), "default": DefaultRiskScoringPreset(), "banking": bankingRiskScoringPreset(), "healthcare": healthcareRiskScoringPreset(), "ecommerce": ecommerceRiskScoringPreset(), "government": governmentRiskScoringPreset(), }
AllRiskScoringPresets contains all available risk scoring presets.
var InvitableRoles = []Role{RoleAdmin, RoleMember, RoleViewer}
InvitableRoles returns the roles that can be assigned when inviting. Note: Owner role cannot be assigned via invitation.
Functions ¶
func GenerateSlug ¶
GenerateSlug generates a slug from a name.
Types ¶
type AIMode ¶
type AIMode string
AIMode represents how the tenant uses AI services.
const ( // AIModeDisabled means AI features are disabled. AIModeDisabled AIMode = "disabled" // AIModePlatform uses the platform's AI (included in subscription). AIModePlatform AIMode = "platform" // AIModeBYOK means tenant brings their own API key. AIModeBYOK AIMode = "byok" // AIModeAgent means tenant uses a self-hosted AI agent. AIModeAgent AIMode = "agent" )
type AISettings ¶
type AISettings struct {
// Mode determines how AI is used: disabled, platform, or byok
Mode AIMode `json:"mode"`
// BYOK (Bring Your Own Key) Configuration - only used when Mode = "byok"
Provider LLMProvider `json:"provider,omitempty"` // claude, openai, azure_openai
APIKey string `json:"api_key,omitempty"` // Encrypted API key (set via special endpoint)
AzureEndpoint string `json:"azure_endpoint,omitempty"` // For Azure OpenAI
ModelOverride string `json:"model_override,omitempty"` // Optional model preference
// Auto-Triage Configuration
AutoTriageEnabled bool `json:"auto_triage_enabled"` // Enable auto-triage on new findings
AutoTriageSeverities []string `json:"auto_triage_severities,omitempty"` // Severities to auto-triage: critical, high, etc.
AutoTriageDelaySeconds int `json:"auto_triage_delay_seconds"` // Delay before auto-triage (for dedup)
// Usage Limits
MonthlyTokenLimit int `json:"monthly_token_limit,omitempty"` // Optional cost control (0 = unlimited)
TokensUsedThisMonth int `json:"tokens_used_this_month"` // Tracked internally
}
AISettings contains AI/LLM configuration for the tenant.
type APISettings ¶
type APISettings struct {
APIKeyEnabled bool `json:"api_key_enabled"` // Enable API key access
WebhookURL string `json:"webhook_url"` // Webhook endpoint URL
WebhookSecret string `json:"webhook_secret"` // Webhook signing secret
WebhookEvents []WebhookEvent `json:"webhook_events"` // Events to send to webhook
}
APISettings contains API and webhook configuration.
func (*APISettings) Validate ¶
func (s *APISettings) Validate() error
Validate validates API settings.
type BranchSettings ¶
type BranchSettings struct {
// TypeRules defines custom prefix/exact-match rules for branch type detection.
// Rules are ordered; first match wins. If no rule matches, falls through
// to system defaults (feature/, release/, hotfix/, main, master, etc.).
TypeRules branch.BranchTypeRules `json:"type_rules,omitempty"`
}
BranchSettings contains branch naming convention configuration. When TypeRules is nil or empty, system defaults are used.
func (*BranchSettings) Validate ¶
func (s *BranchSettings) Validate() error
Validate validates branch settings.
type BrandingSettings ¶
type BrandingSettings struct {
PrimaryColor string `json:"primary_color"` // Hex color code, e.g., "#3B82F6"
LogoDarkURL string `json:"logo_dark_url"` // Logo for dark theme (URL)
LogoData string `json:"logo_data"` // Logo as base64 data URL (max 150KB)
}
BrandingSettings contains branding configuration.
func (*BrandingSettings) Validate ¶
func (s *BrandingSettings) Validate() error
Validate validates branding settings.
type CTEMPointsConfig ¶ added in v0.1.2
type ComponentWeights ¶ added in v0.1.2
type ConfigOption ¶ added in v0.1.2
ConfigOption represents a configurable option with value and label.
type CriticalityScoreConfig ¶ added in v0.1.2
type ExposureMultiplierConfig ¶ added in v0.1.2
type ExposureScoreConfig ¶ added in v0.1.2
type FindingImpactConfig ¶ added in v0.1.2
type FindingImpactConfig struct {
Mode string `json:"mode"`
PerFindingPoints int `json:"per_finding_points"`
FindingCap int `json:"finding_cap"`
SeverityWeights SeverityWeightConfig `json:"severity_weights"`
}
type GeneralSettings ¶
type GeneralSettings struct {
Timezone string `json:"timezone"` // e.g., "Asia/Ho_Chi_Minh", "UTC"
Language string `json:"language"` // e.g., "en", "vi"
Industry string `json:"industry"` // e.g., "technology", "finance", "healthcare"
Website string `json:"website"` // Company website URL
}
GeneralSettings contains general tenant configuration.
func (*GeneralSettings) Validate ¶
func (s *GeneralSettings) Validate() error
Validate validates general settings.
type Invitation ¶
type Invitation struct {
// contains filtered or unexported fields
}
Invitation represents an invitation to join a tenant.
func NewInvitation ¶
func NewInvitation(tenantID shared.ID, email string, role Role, invitedBy shared.ID, roleIDs []string) (*Invitation, error)
NewInvitation creates a new Invitation. invitedBy is the local user ID (from users table) of the person sending the invitation. roleIDs are the RBAC role IDs to assign when user accepts the invitation.
func ReconstituteInvitation ¶
func ReconstituteInvitation( id shared.ID, tenantID shared.ID, email string, role Role, roleIDs []string, token string, invitedBy shared.ID, expiresAt time.Time, acceptedAt *time.Time, createdAt time.Time, ) *Invitation
ReconstituteInvitation recreates an Invitation from persistence.
func (*Invitation) Accept ¶
func (i *Invitation) Accept() error
Accept marks the invitation as accepted.
func (*Invitation) AcceptedAt ¶
func (i *Invitation) AcceptedAt() *time.Time
AcceptedAt returns when the invitation was accepted (nil if not accepted).
func (*Invitation) CreatedAt ¶
func (i *Invitation) CreatedAt() time.Time
CreatedAt returns when the invitation was created.
func (*Invitation) ExpiresAt ¶
func (i *Invitation) ExpiresAt() time.Time
ExpiresAt returns when the invitation expires.
func (*Invitation) InvitedBy ¶
func (i *Invitation) InvitedBy() shared.ID
InvitedBy returns the local user ID of who sent the invitation.
func (*Invitation) IsAccepted ¶
func (i *Invitation) IsAccepted() bool
IsAccepted checks if the invitation has been accepted.
func (*Invitation) IsExpired ¶
func (i *Invitation) IsExpired() bool
IsExpired checks if the invitation has expired.
func (*Invitation) IsPending ¶
func (i *Invitation) IsPending() bool
IsPending checks if the invitation is pending (not expired and not accepted).
func (*Invitation) Role ¶
func (i *Invitation) Role() Role
Role returns the membership role to be assigned.
func (*Invitation) RoleIDs ¶
func (i *Invitation) RoleIDs() []string
RoleIDs returns the RBAC role IDs to be assigned when user accepts.
func (*Invitation) TenantID ¶
func (i *Invitation) TenantID() shared.ID
TenantID returns the tenant ID.
type LLMProvider ¶
type LLMProvider string
LLMProvider represents supported LLM providers.
const ( LLMProviderClaude LLMProvider = "claude" LLMProviderOpenAI LLMProvider = "openai" LLMProviderAzureOpenAI LLMProvider = "azure_openai" LLMProviderGemini LLMProvider = "gemini" )
func (LLMProvider) IsValid ¶
func (p LLMProvider) IsValid() bool
IsValid checks if the LLM provider is valid.
type MemberInfo ¶
type MemberInfo struct {
Membership *Membership
UserID shared.ID // Local user ID
Email string // From local users table
Name string // From local users table
AvatarURL string // From local users table
}
MemberInfo represents a membership with user info. Note: User info should be fetched from the local users table by the service layer.
type MemberSearchFilters ¶
type MemberSearchFilters struct {
Search string // Search by name or email (case-insensitive)
Limit int // Maximum number of results (0 = no limit)
Offset int // Offset for pagination
}
MemberSearchFilters defines filters for searching members.
type MemberSearchResult ¶
type MemberSearchResult struct {
Members []*MemberWithUser
Total int // Total matching members (before limit)
}
MemberSearchResult contains the search results and total count.
type MemberStats ¶
type MemberStats struct {
TotalMembers int `json:"total_members"`
ActiveMembers int `json:"active_members"`
PendingInvites int `json:"pending_invites"`
RoleCounts map[string]int `json:"role_counts"`
}
MemberStats contains statistics about tenant members.
type MemberWithUser ¶
type MemberWithUser struct {
// Membership fields
ID shared.ID
UserID shared.ID
Role Role
InvitedBy *shared.ID
JoinedAt time.Time
// User fields
Email string
Name string
AvatarURL string
Status string // active, pending, inactive
LastLoginAt *time.Time
}
MemberWithUser represents a membership joined with user details.
type Membership ¶
type Membership struct {
// contains filtered or unexported fields
}
Membership represents a user's membership in a tenant. Note: Role is now stored in the user_roles table, not in tenant_members. The role field here is populated from v_user_effective_role view on read, and used for initial role assignment on create.
func NewMembership ¶
func NewMembership(userID, tenantID shared.ID, role Role, invitedBy *shared.ID) (*Membership, error)
NewMembership creates a new Membership.
func NewOwnerMembership ¶
func NewOwnerMembership(userID, tenantID shared.ID) (*Membership, error)
NewOwnerMembership creates a membership for the tenant owner.
func ReconstituteMembership ¶
func ReconstituteMembership( id shared.ID, userID shared.ID, tenantID shared.ID, role Role, invitedBy *shared.ID, joinedAt time.Time, ) *Membership
ReconstituteMembership recreates a Membership from persistence.
func (*Membership) CanRead ¶
func (m *Membership) CanRead() bool
CanRead checks if this membership has read permissions.
func (*Membership) CanWrite ¶
func (m *Membership) CanWrite() bool
CanWrite checks if this membership has write permissions.
func (*Membership) InvitedBy ¶
func (m *Membership) InvitedBy() *shared.ID
InvitedBy returns the user ID who invited this member.
func (*Membership) IsAdmin ¶
func (m *Membership) IsAdmin() bool
IsAdmin checks if this membership has admin role.
func (*Membership) IsOwner ¶
func (m *Membership) IsOwner() bool
IsOwner checks if this membership has owner role.
func (*Membership) JoinedAt ¶
func (m *Membership) JoinedAt() time.Time
JoinedAt returns when the member joined.
func (*Membership) TenantID ¶
func (m *Membership) TenantID() shared.ID
TenantID returns the tenant ID.
func (*Membership) UpdateRole ¶
func (m *Membership) UpdateRole(role Role) error
UpdateRole updates the member's role.
func (*Membership) UserID ¶
func (m *Membership) UserID() shared.ID
UserID returns the local user ID.
type PentestSettings ¶ added in v0.1.2
type PentestSettings struct {
CampaignTypes []ConfigOption `json:"campaign_types,omitempty"`
Methodologies []ConfigOption `json:"methodologies,omitempty"`
}
PentestSettings holds pentest-related configuration per tenant.
func (*PentestSettings) Validate ¶ added in v0.1.2
func (s *PentestSettings) Validate() error
Validate validates pentest settings.
type Plan ¶
type Plan string
Plan represents a tenant's module configuration. In OSS edition, all tenants have unlimited access.
const ( // PlanFree is the only plan in OSS edition - provides full access PlanFree Plan = "free" )
func (Plan) GetLimits ¶
func (p Plan) GetLimits() PlanLimits
GetLimits returns the limits for this plan. In OSS edition, all features are unlimited.
type PlanLimits ¶
type PlanLimits struct {
MaxMembers int
MaxAssets int
MaxScansMonth int
SSO bool
AuditLog bool
APIAccess bool
}
PlanLimits defines the limits for each plan. In OSS edition, all limits are unlimited (-1).
type Repository ¶
type Repository interface {
// Tenant CRUD
Create(ctx context.Context, t *Tenant) error
GetByID(ctx context.Context, id shared.ID) (*Tenant, error)
GetBySlug(ctx context.Context, slug string) (*Tenant, error)
Update(ctx context.Context, t *Tenant) error
Delete(ctx context.Context, id shared.ID) error
ExistsBySlug(ctx context.Context, slug string) (bool, error)
// ListActiveTenantIDs returns all active tenant IDs.
// Used by background jobs that need to process data across all tenants.
ListActiveTenantIDs(ctx context.Context) ([]shared.ID, error)
// Membership operations
CreateMembership(ctx context.Context, membership *Membership) error
GetMembership(ctx context.Context, userID shared.ID, tenantID shared.ID) (*Membership, error)
GetMembershipByID(ctx context.Context, id shared.ID) (*Membership, error)
UpdateMembership(ctx context.Context, membership *Membership) error
DeleteMembership(ctx context.Context, id shared.ID) error
ListMembersByTenant(ctx context.Context, tenantID shared.ID) ([]*Membership, error)
ListMembersWithUserInfo(ctx context.Context, tenantID shared.ID) ([]*MemberWithUser, error)
SearchMembersWithUserInfo(ctx context.Context, tenantID shared.ID, filters MemberSearchFilters) (*MemberSearchResult, error)
ListTenantsByUser(ctx context.Context, userID shared.ID) ([]*TenantWithRole, error)
CountMembersByTenant(ctx context.Context, tenantID shared.ID) (int64, error)
GetMemberStats(ctx context.Context, tenantID shared.ID) (*MemberStats, error)
// GetUserMemberships returns lightweight membership data for JWT tokens
GetUserMemberships(ctx context.Context, userID shared.ID) ([]UserMembership, error)
// GetMemberByEmail retrieves a member by email address within a tenant
GetMemberByEmail(ctx context.Context, tenantID shared.ID, email string) (*MemberWithUser, error)
// Invitation operations
CreateInvitation(ctx context.Context, invitation *Invitation) error
GetInvitationByToken(ctx context.Context, token string) (*Invitation, error)
GetInvitationByID(ctx context.Context, id shared.ID) (*Invitation, error)
UpdateInvitation(ctx context.Context, invitation *Invitation) error
DeleteInvitation(ctx context.Context, id shared.ID) error
ListPendingInvitationsByTenant(ctx context.Context, tenantID shared.ID) ([]*Invitation, error)
GetPendingInvitationByEmail(ctx context.Context, tenantID shared.ID, email string) (*Invitation, error)
DeleteExpiredInvitations(ctx context.Context) (int64, error)
// AcceptInvitationTx atomically updates the invitation and creates the membership in a single transaction.
// This ensures data consistency - either both operations succeed or neither does.
AcceptInvitationTx(ctx context.Context, invitation *Invitation, membership *Membership) error
}
Repository defines the interface for tenant persistence.
type RiskLevelConfig ¶ added in v0.1.2
type RiskScoringSettings ¶ added in v0.1.2
type RiskScoringSettings struct {
Preset string `json:"preset,omitempty"`
Weights ComponentWeights `json:"weights"`
ExposureScores ExposureScoreConfig `json:"exposure_scores"`
ExposureMultipliers ExposureMultiplierConfig `json:"exposure_multipliers"`
CriticalityScores CriticalityScoreConfig `json:"criticality_scores"`
FindingImpact FindingImpactConfig `json:"finding_impact"`
CTEMPoints CTEMPointsConfig `json:"ctem_points"`
RiskLevels RiskLevelConfig `json:"risk_levels"`
}
RiskScoringSettings configures the risk scoring formula per tenant.
func DefaultRiskScoringPreset ¶ added in v0.1.2
func DefaultRiskScoringPreset() RiskScoringSettings
DefaultRiskScoringPreset returns the recommended risk scoring settings for new tenants who opt-in to configurable risk scoring.
func LegacyRiskScoringSettings ¶ added in v0.1.2
func LegacyRiskScoringSettings() RiskScoringSettings
LegacyRiskScoringSettings returns settings that reproduce the exact current hardcoded risk scoring formula for backward compatibility.
func RiskScoringPreset ¶ added in v0.1.2
func RiskScoringPreset(name string) (RiskScoringSettings, bool)
RiskScoringPreset returns a preset by name.
func (*RiskScoringSettings) Validate ¶ added in v0.1.2
func (s *RiskScoringSettings) Validate() error
Validate validates the risk scoring settings.
type Role ¶
type Role string
Role represents a user's role within a tenant.
func (Role) CanAssignRole ¶
CanAssignRole checks if this role can assign the target role to others.
func (Role) CanManageBilling ¶
CanManageBilling checks if this role can manage billing.
func (Role) CanManageMembers ¶
CanManageMembers checks if this role can manage (update/remove) members.
type SecuritySettings ¶
type SecuritySettings struct {
SSOEnabled bool `json:"sso_enabled"` // Enable SSO (SAML 2.0, OIDC)
SSOProvider string `json:"sso_provider"` // e.g., "saml", "oidc"
SSOConfigURL string `json:"sso_config_url"` // SSO metadata/config URL
MFARequired bool `json:"mfa_required"` // Require MFA for all users
SessionTimeoutMin int `json:"session_timeout_min"` // Session timeout in minutes (15-480)
IPWhitelist []string `json:"ip_whitelist"` // Allowed IP addresses/CIDR ranges
AllowedDomains []string `json:"allowed_domains"` // Allowed email domains for signup
}
SecuritySettings contains security-related configuration.
func (*SecuritySettings) Validate ¶
func (s *SecuritySettings) Validate() error
Validate validates security settings.
type Settings ¶
type Settings struct {
General GeneralSettings `json:"general"`
Security SecuritySettings `json:"security"`
API APISettings `json:"api"`
Branding BrandingSettings `json:"branding"`
Branch BranchSettings `json:"branch"`
AI AISettings `json:"ai"`
RiskScoring RiskScoringSettings `json:"risk_scoring"`
Pentest PentestSettings `json:"pentest"`
}
Settings represents the typed settings for a tenant.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the default settings for a new tenant.
func SettingsFromMap ¶
SettingsFromMap converts map[string]any to Settings.
type SeverityWeightConfig ¶ added in v0.1.2
type Tenant ¶
type Tenant struct {
// contains filtered or unexported fields
}
Tenant represents a tenant (displayed as "Team" in UI) entity.
func Reconstitute ¶
func Reconstitute( id shared.ID, name, slug, description, logoURL string, settings map[string]any, createdBy string, createdAt, updatedAt time.Time, ) *Tenant
Reconstitute recreates a Tenant from persistence.
func (*Tenant) Description ¶
Description returns the tenant description.
func (*Tenant) GetSetting ¶
GetSetting gets a setting value.
func (*Tenant) Plan ¶
Plan returns the tenant's module configuration. In OSS edition, all tenants have the free plan with unlimited access.
func (*Tenant) SetSetting ¶
SetSetting sets a setting value.
func (*Tenant) TypedSettings ¶
TypedSettings returns the settings as a typed Settings struct.
func (*Tenant) UpdateAISettings ¶
func (t *Tenant) UpdateAISettings(ai AISettings) error
UpdateAISettings updates only the AI settings.
func (*Tenant) UpdateAPISettings ¶
func (t *Tenant) UpdateAPISettings(api APISettings) error
UpdateAPISettings updates only the API settings.
func (*Tenant) UpdateBranchSettings ¶
func (t *Tenant) UpdateBranchSettings(bs BranchSettings) error
UpdateBranchSettings updates only the branch naming convention settings.
func (*Tenant) UpdateBrandingSettings ¶
func (t *Tenant) UpdateBrandingSettings(branding BrandingSettings) error
UpdateBrandingSettings updates only the branding settings.
func (*Tenant) UpdateDescription ¶
UpdateDescription updates the tenant description.
func (*Tenant) UpdateGeneralSettings ¶
func (t *Tenant) UpdateGeneralSettings(general GeneralSettings) error
UpdateGeneralSettings updates only the general settings.
func (*Tenant) UpdateLogoURL ¶
UpdateLogoURL updates the tenant logo URL.
func (*Tenant) UpdateName ¶
UpdateName updates the tenant name.
func (*Tenant) UpdatePentestSettings ¶ added in v0.1.2
func (t *Tenant) UpdatePentestSettings(ps PentestSettings) error
UpdatePentestSettings updates only the pentest settings.
func (*Tenant) UpdatePlan ¶
UpdatePlan updates the tenant's module configuration. In OSS edition, this is a no-op as all tenants have unlimited access.
func (*Tenant) UpdateRiskScoringSettings ¶ added in v0.1.2
func (t *Tenant) UpdateRiskScoringSettings(rs RiskScoringSettings) error
UpdateRiskScoringSettings updates only the risk scoring settings.
func (*Tenant) UpdateSecuritySettings ¶
func (t *Tenant) UpdateSecuritySettings(security SecuritySettings) error
UpdateSecuritySettings updates only the security settings.
func (*Tenant) UpdateSettings ¶
UpdateSettings updates the tenant settings with a typed Settings struct.
func (*Tenant) UpdateSlug ¶
UpdateSlug updates the tenant slug. Note: Caller must verify uniqueness before calling this method.
type TenantWithRole ¶
TenantWithRole represents a tenant with the user's role in it.
type UserMembership ¶
type UserMembership struct {
TenantID string // Tenant UUID
TenantSlug string // Tenant slug for URL-friendly access
TenantName string // Tenant display name
Role string // Role in tenant (owner, admin, member, viewer)
}
UserMembership is a lightweight struct for JWT token generation. Contains only the essential data needed for authorization.
type WebhookEvent ¶
type WebhookEvent string
WebhookEvent represents a webhook event type.
const ( WebhookEventFindingCreated WebhookEvent = "finding.created" WebhookEventFindingResolved WebhookEvent = "finding.resolved" WebhookEventFindingUpdated WebhookEvent = "finding.updated" WebhookEventScanCompleted WebhookEvent = "scan.completed" WebhookEventScanFailed WebhookEvent = "scan.failed" WebhookEventAssetDiscovered WebhookEvent = "asset.discovered" WebhookEventAssetUpdated WebhookEvent = "asset.updated" WebhookEventMemberJoined WebhookEvent = "member.joined" WebhookEventMemberRemoved WebhookEvent = "member.removed" )
func ValidWebhookEvents ¶
func ValidWebhookEvents() []WebhookEvent
ValidWebhookEvents returns all valid webhook events.
func (WebhookEvent) IsValid ¶
func (e WebhookEvent) IsValid() bool
IsValid checks if the webhook event is valid.