Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PermissionAction ¶
type PermissionAction struct {
bun.BaseModel `bun:"table:permission_actions,alias:pa"`
// Primary key
ID xid.ID `bun:"id,pk,type:varchar(20)" json:"id"`
// Namespace relationship
NamespaceID xid.ID `bun:"namespace_id,notnull,type:varchar(20)" json:"namespaceId"`
// Action details
Name string `bun:"name,notnull" json:"name"`
Description string `bun:"description" json:"description"`
// Audit fields
CreatedAt time.Time `bun:"created_at,notnull,default:current_timestamp" json:"createdAt"`
}
PermissionAction represents an action definition in the database
func (PermissionAction) TableName ¶
func (PermissionAction) TableName() string
TableName returns the table name for PermissionAction
type PermissionAuditLog ¶
type PermissionAuditLog struct {
bun.BaseModel `bun:"table:permission_audit_logs,alias:pal"`
// Primary key
ID xid.ID `bun:"id,pk,type:varchar(20)" json:"id"`
// V2 Multi-tenant context
AppID xid.ID `bun:"app_id,notnull,type:varchar(20)" json:"appId"`
UserOrganizationID *xid.ID `bun:"user_organization_id,type:varchar(20)" json:"userOrganizationId,omitempty"`
// Audit details
ActorID xid.ID `bun:"actor_id,notnull,type:varchar(20)" json:"actorId"`
Action string `bun:"action,notnull" json:"action"`
ResourceType string `bun:"resource_type" json:"resourceType"`
ResourceID xid.ID `bun:"resource_id,type:varchar(20)" json:"resourceId"`
OldValue map[string]interface{} `bun:"old_value,type:jsonb" json:"oldValue,omitempty"`
NewValue map[string]interface{} `bun:"new_value,type:jsonb" json:"newValue,omitempty"`
// Request metadata
IPAddress string `bun:"ip_address" json:"ipAddress"`
UserAgent string `bun:"user_agent" json:"userAgent"`
// Timestamp
Timestamp time.Time `bun:"timestamp,notnull,default:current_timestamp" json:"timestamp"`
}
PermissionAuditLog represents an audit log entry in the database Updated for V2 architecture: App → Environment → Organization
func (PermissionAuditLog) TableName ¶
func (PermissionAuditLog) TableName() string
TableName returns the table name for PermissionAuditLog
type PermissionEvaluationStats ¶
type PermissionEvaluationStats struct {
bun.BaseModel `bun:"table:permission_evaluation_stats,alias:pes"`
// Primary key
ID xid.ID `bun:"id,pk,type:varchar(20)" json:"id"`
// V2 Multi-tenant context
AppID xid.ID `bun:"app_id,notnull,type:varchar(20)" json:"appId"`
UserOrganizationID *xid.ID `bun:"user_organization_id,type:varchar(20)" json:"userOrganizationId,omitempty"`
// Policy reference
PolicyID xid.ID `bun:"policy_id,notnull,type:varchar(20)" json:"policyId"`
// Statistics
EvaluationCount int64 `bun:"evaluation_count,default:0" json:"evaluationCount"`
AllowCount int64 `bun:"allow_count,default:0" json:"allowCount"`
DenyCount int64 `bun:"deny_count,default:0" json:"denyCount"`
ErrorCount int64 `bun:"error_count,default:0" json:"errorCount"`
TotalLatencyMs float64 `bun:"total_latency_ms,default:0" json:"totalLatencyMs"`
AvgLatencyMs float64 `bun:"avg_latency_ms,default:0" json:"avgLatencyMs"`
P50LatencyMs float64 `bun:"p50_latency_ms,default:0" json:"p50LatencyMs"`
P99LatencyMs float64 `bun:"p99_latency_ms,default:0" json:"p99LatencyMs"`
LastEvaluated time.Time `bun:"last_evaluated" json:"lastEvaluated"`
// Audit fields
CreatedAt time.Time `bun:"created_at,notnull,default:current_timestamp" json:"createdAt"`
UpdatedAt time.Time `bun:"updated_at,notnull,default:current_timestamp" json:"updatedAt"`
}
PermissionEvaluationStats tracks policy evaluation statistics Updated for V2 architecture: App → Environment → Organization
func (PermissionEvaluationStats) TableName ¶
func (PermissionEvaluationStats) TableName() string
TableName returns the table name for PermissionEvaluationStats
type PermissionNamespace ¶
type PermissionNamespace struct {
bun.BaseModel `bun:"table:permission_namespaces,alias:pn"`
// Primary key
ID xid.ID `bun:"id,pk,type:varchar(20)" json:"id"`
// V2 Multi-tenant context
AppID xid.ID `bun:"app_id,notnull,type:varchar(20)" json:"appId"`
UserOrganizationID *xid.ID `bun:"user_organization_id,type:varchar(20)" json:"userOrganizationId,omitempty"`
// Namespace details
Name string `bun:"name,notnull" json:"name"`
Description string `bun:"description" json:"description"`
TemplateID *xid.ID `bun:"template_id,type:varchar(20)" json:"templateId,omitempty"`
InheritPlatform bool `bun:"inherit_platform,default:false" json:"inheritPlatform"`
// Audit fields
CreatedAt time.Time `bun:"created_at,notnull,default:current_timestamp" json:"createdAt"`
UpdatedAt time.Time `bun:"updated_at,notnull,default:current_timestamp" json:"updatedAt"`
}
PermissionNamespace represents a permission namespace in the database Updated for V2 architecture: App → Environment → Organization
func (PermissionNamespace) TableName ¶
func (PermissionNamespace) TableName() string
TableName returns the table name for PermissionNamespace
type PermissionPolicy ¶
type PermissionPolicy struct {
bun.BaseModel `bun:"table:permission_policies,alias:pp"`
// Primary key
ID xid.ID `bun:"id,pk,type:varchar(20)" json:"id"`
// V2 Multi-tenant context
AppID xid.ID `bun:"app_id,notnull,type:varchar(20)" json:"appId"`
UserOrganizationID *xid.ID `bun:"user_organization_id,type:varchar(20)" json:"userOrganizationId,omitempty"`
// Policy details
NamespaceID xid.ID `bun:"namespace_id,notnull,type:varchar(20)" json:"namespaceId"`
Name string `bun:"name,notnull" json:"name"`
Description string `bun:"description" json:"description"`
Expression string `bun:"expression,notnull" json:"expression"`
ResourceType string `bun:"resource_type,notnull" json:"resourceType"`
Actions []string `bun:"actions,array" json:"actions"`
Priority int `bun:"priority,default:0" json:"priority"`
Enabled bool `bun:"enabled,default:true" json:"enabled"`
Version int `bun:"version,default:1" json:"version"`
// Audit fields
CreatedBy xid.ID `bun:"created_by,type:varchar(20)" json:"createdBy"`
CreatedAt time.Time `bun:"created_at,notnull,default:current_timestamp" json:"createdAt"`
UpdatedAt time.Time `bun:"updated_at,notnull,default:current_timestamp" json:"updatedAt"`
}
PermissionPolicy represents a permission policy in the database Updated for V2 architecture: App → Environment → Organization
func (PermissionPolicy) TableName ¶
func (PermissionPolicy) TableName() string
TableName returns the table name for PermissionPolicy
type PermissionResource ¶
type PermissionResource struct {
bun.BaseModel `bun:"table:permission_resources,alias:pr"`
// Primary key
ID xid.ID `bun:"id,pk,type:varchar(20)" json:"id"`
// Namespace relationship
NamespaceID xid.ID `bun:"namespace_id,notnull,type:varchar(20)" json:"namespaceId"`
// Resource details
Type string `bun:"type,notnull" json:"type"`
Description string `bun:"description" json:"description"`
Attributes []ResourceAttribute `bun:"attributes,type:jsonb" json:"attributes"`
// Audit fields
CreatedAt time.Time `bun:"created_at,notnull,default:current_timestamp" json:"createdAt"`
}
PermissionResource represents a resource type definition in the database
func (PermissionResource) TableName ¶
func (PermissionResource) TableName() string
TableName returns the table name for PermissionResource
type ResourceAttribute ¶
type ResourceAttribute struct {
Name string `json:"name"`
Type string `json:"type"`
Required bool `json:"required"`
Default interface{} `json:"default,omitempty"`
Description string `json:"description,omitempty"`
}
ResourceAttribute represents an attribute definition for a resource type