Documentation
¶
Index ¶
- func ParseRcloneFlags(flagsStr string) map[string]string
- type AuditLog
- type AuditLogDetails
- type AuthProvider
- type DB
- func (db *DB) AssignRoleToUser(roleID, userID, assignedByID uint) error
- func (db *DB) BuildRcloneCommand(commandName string, flags map[string]string) (string, error)
- func (db *DB) Close() error
- func (db *DB) CountExternalUserIdentitiesByProviderID(ctx context.Context, providerID uint) (int64, error)
- func (db *DB) CreateAuthProvider(ctx context.Context, provider *AuthProvider) error
- func (db *DB) CreateConfigNotification(userID uint, configID uint, title string, message string) error
- func (db *DB) CreateExternalUserIdentity(ctx context.Context, identity *ExternalUserIdentity) error
- func (db *DB) CreateFileMetadata(metadata *FileMetadata) error
- func (db *DB) CreateJob(job *Job) error
- func (db *DB) CreateJobHistory(history *JobHistory) error
- func (db *DB) CreateJobNotification(userID uint, jobID uint, jobRunID uint, notificationType NotificationType, ...) error
- func (db *DB) CreateNotificationService(service *NotificationService) error
- func (db *DB) CreatePasswordResetToken(token *PasswordResetToken) error
- func (db *DB) CreateRole(role *Role) error
- func (db *DB) CreateSystemNotification(title string, message string) error
- func (db *DB) CreateTransferConfig(config *TransferConfig) error
- func (db *DB) CreateUser(user *User) error
- func (db *DB) DeleteAuthProvider(ctx context.Context, id uint) error
- func (db *DB) DeleteExternalUserIdentity(ctx context.Context, id uint) error
- func (db *DB) DeleteFileMetadata(id uint) error
- func (db *DB) DeleteJob(id uint) error
- func (db *DB) DeleteNotificationService(id uint) error
- func (db *DB) DeleteRole(id uint) error
- func (db *DB) DeleteTransferConfig(id uint) error
- func (db *DB) GenerateRcloneConfig(config *TransferConfig) error
- func (db *DB) GenerateRcloneConfigWithToken(config *TransferConfig, token string) error
- func (db *DB) GetActiveJobs() ([]Job, error)
- func (db *DB) GetAllAuthProviders(ctx context.Context) ([]AuthProvider, error)
- func (db *DB) GetAuthProviderByID(ctx context.Context, id uint) (*AuthProvider, error)
- func (db *DB) GetAuthProviderByType(ctx context.Context, providerType ProviderType) ([]AuthProvider, error)
- func (db *DB) GetConfigRclonePath(config *TransferConfig) string
- func (db *DB) GetConfigsForJob(jobID uint) ([]TransferConfig, error)
- func (db *DB) GetEnabledAuthProviders(ctx context.Context) ([]AuthProvider, error)
- func (db *DB) GetExternalUserIdentitiesByProviderID(ctx context.Context, providerID uint) ([]ExternalUserIdentity, error)
- func (db *DB) GetExternalUserIdentity(ctx context.Context, providerID uint, externalID string) (*ExternalUserIdentity, error)
- func (db *DB) GetFileMetadataByHash(fileHash string) (*FileMetadata, error)
- func (db *DB) GetFileMetadataByJobAndName(jobID uint, fileName string) (*FileMetadata, error)
- func (db *DB) GetGDriveCredentialsFromConfig(config *TransferConfig) (string, string)
- func (db *DB) GetJob(id uint) (*Job, error)
- func (db *DB) GetJobHistory(jobID uint) ([]JobHistory, error)
- func (db *DB) GetJobs(userID uint) ([]Job, error)
- func (db *DB) GetNotificationService(id uint) (*NotificationService, error)
- func (db *DB) GetNotificationServices(onlyEnabled bool) ([]NotificationService, error)
- func (db *DB) GetPaginatedUserNotifications(userID uint, offset, limit int) ([]UserNotification, error)
- func (db *DB) GetPasswordResetToken(token string) (*PasswordResetToken, error)
- func (db *DB) GetRcloneCategories() ([]string, error)
- func (db *DB) GetRcloneCommand(id uint) (*RcloneCommand, error)
- func (db *DB) GetRcloneCommandByName(name string) (*RcloneCommand, error)
- func (db *DB) GetRcloneCommandFlag(id uint) (*RcloneCommandFlag, error)
- func (db *DB) GetRcloneCommandFlagByName(commandID uint, name string) (*RcloneCommandFlag, error)
- func (db *DB) GetRcloneCommandFlags(commandID uint) ([]RcloneCommandFlag, error)
- func (db *DB) GetRcloneCommandFlagsMap(commandID uint) (map[uint]RcloneCommandFlag, error)
- func (db *DB) GetRcloneCommandUsage(commandID uint) (string, error)
- func (db *DB) GetRcloneCommandWithFlags(commandID uint) (*RcloneCommand, error)
- func (db *DB) GetRcloneCommands() ([]RcloneCommand, error)
- func (db *DB) GetRcloneCommandsByAdvanced(isAdvanced bool) ([]RcloneCommand, error)
- func (db *DB) GetRcloneCommandsInCategory(category string) ([]RcloneCommand, error)
- func (db *DB) GetRole(id uint) (*Role, error)
- func (db *DB) GetRoleByName(name string) (*Role, error)
- func (db *DB) GetTransferConfig(id uint) (*TransferConfig, error)
- func (db *DB) GetTransferConfigs(userID uint) ([]TransferConfig, error)
- func (db *DB) GetUnreadNotificationCount(userID uint) (int64, error)
- func (db *DB) GetUserByEmail(email string) (*User, error)
- func (db *DB) GetUserByID(id uint) (*User, error)
- func (db *DB) GetUserNotificationCount(userID uint) (int64, error)
- func (db *DB) GetUserNotifications(userID uint, limit int) ([]UserNotification, error)
- func (db *DB) GetUserRoles(userID uint) ([]Role, error)
- func (db *DB) ListRoles() ([]Role, error)
- func (db *DB) MarkAllNotificationsAsRead(userID uint) error
- func (db *DB) MarkNotificationAsRead(id uint) error
- func (db *DB) MarkPasswordResetTokenAsUsed(tokenID uint) error
- func (db *DB) RenderRcloneCommandHelp(commandID uint) (string, error)
- func (db *DB) SearchRcloneCommands(query string) ([]RcloneCommand, error)
- func (db *DB) StoreGoogleDriveToken(configIDStr string, token string) error
- func (db *DB) UnassignRoleFromUser(roleID, userID, unassignedByID uint) error
- func (db *DB) UpdateAuthProvider(ctx context.Context, provider *AuthProvider) error
- func (db *DB) UpdateAuthProviderLastUsed(ctx context.Context, providerID uint) error
- func (db *DB) UpdateExternalUserIdentity(ctx context.Context, identity *ExternalUserIdentity) error
- func (db *DB) UpdateJob(job *Job) error
- func (db *DB) UpdateJobHistory(history *JobHistory) error
- func (db *DB) UpdateJobStatus(job *Job) error
- func (db *DB) UpdateNotificationService(service *NotificationService) error
- func (db *DB) UpdateRole(role *Role) error
- func (db *DB) UpdateTransferConfig(config *TransferConfig) error
- func (db *DB) UpdateUser(user *User) error
- func (db *DB) ValidateRcloneFlags(commandName string, flags map[string]string) (bool, map[string]string)
- type ExternalUserIdentity
- type FileMetadata
- type Job
- func (j *Job) GetConfigIDsAsStrings() []string
- func (j *Job) GetConfigIDsList() []uint
- func (j *Job) GetEnabled() bool
- func (j *Job) GetNotifyOnFailure() bool
- func (j *Job) GetNotifyOnSuccess() bool
- func (j *Job) GetWebhookEnabled() bool
- func (j *Job) SetConfigIDsList(ids []uint)
- func (j *Job) SetEnabled(value bool)
- func (j *Job) SetNotifyOnFailure(value bool)
- func (j *Job) SetNotifyOnSuccess(value bool)
- func (j *Job) SetWebhookEnabled(value bool)
- type JobHistory
- type NotificationService
- type NotificationType
- type PasswordHistory
- type PasswordResetToken
- type Permissions
- type ProviderType
- type RcloneCommand
- type RcloneCommandFlag
- type Role
- func (r *Role) AddPermission(permission string)
- func (r *Role) AfterCreate(tx *gorm.DB) error
- func (r *Role) AfterUpdate(tx *gorm.DB) error
- func (r *Role) AssignToUser(tx *gorm.DB, userID uint, assignedByID uint) error
- func (r *Role) AuditLog(tx *gorm.DB, action string, userID uint) error
- func (r *Role) BeforeDelete(tx *gorm.DB) error
- func (r *Role) BeforeSave(tx *gorm.DB) error
- func (r *Role) GetPermissions() []string
- func (r *Role) HasPermission(permission string) bool
- func (r *Role) IsSystemRole() bool
- func (r *Role) RemovePermission(permission string)
- func (r *Role) SetPermissions(permissions []string)
- func (r *Role) UnassignFromUser(tx *gorm.DB, userID uint, unassignedByID uint) error
- func (r *Role) Validate() error
- type TransferConfig
- func (tc *TransferConfig) GetArchiveEnabled() bool
- func (tc *TransferConfig) GetDeleteAfterTransfer() bool
- func (tc *TransferConfig) GetDestPassiveMode() bool
- func (tc *TransferConfig) GetGoogleAuthenticated() bool
- func (tc *TransferConfig) GetGoogleDriveAuthenticated() bool
- func (tc *TransferConfig) GetSkipProcessedFiles() bool
- func (tc *TransferConfig) GetSourcePassiveMode() bool
- func (tc *TransferConfig) GetUseBuiltinAuthDest() bool
- func (tc *TransferConfig) GetUseBuiltinAuthSource() bool
- func (tc *TransferConfig) SetArchiveEnabled(value bool)
- func (tc *TransferConfig) SetDeleteAfterTransfer(value bool)
- func (tc *TransferConfig) SetDestPassiveMode(value bool)
- func (tc *TransferConfig) SetGoogleAuthenticated(value bool)
- func (tc *TransferConfig) SetGoogleDriveAuthenticated(value bool)
- func (tc *TransferConfig) SetSkipProcessedFiles(value bool)
- func (tc *TransferConfig) SetSourcePassiveMode(value bool)
- func (tc *TransferConfig) SetUseBuiltinAuthDest(value bool)
- func (tc *TransferConfig) SetUseBuiltinAuthSource(value bool)
- type User
- func (u *User) AssignRole(tx *gorm.DB, roleID uint, assignedByID uint) error
- func (u *User) CheckPassword(password string) bool
- func (u *User) GetAccountLocked() bool
- func (u *User) GetIsAdmin() bool
- func (u *User) GetRoles(tx *gorm.DB) ([]Role, error)
- func (u *User) HasPermission(permission string) bool
- func (u *User) HasRole(roleName string) bool
- func (u *User) SetAccountLocked(value bool)
- func (u *User) SetIsAdmin(value bool)
- func (u *User) SetPassword(password string) error
- func (u *User) UnassignRole(tx *gorm.DB, roleID uint, unassignedByID uint) error
- type UserNotification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRcloneFlags ¶ added in v0.2.0
ParseRcloneFlags parses a string of rclone flags into a map Note: This is a general utility function, not tied to a specific struct instance. It might be better placed in a more general utility package if one exists, but keeping it here for now as per the original file structure.
Types ¶
type AuditLog ¶ added in v0.2.0
type AuditLog struct {
gorm.Model
Action string `gorm:"size:50;not null;index"`
EntityType string `gorm:"size:50;not null;index"`
EntityID uint `gorm:"not null;index"`
UserID uint `gorm:"not null;index"`
Details AuditLogDetails `gorm:"type:json"`
Timestamp time.Time `gorm:"not null;index;default:CURRENT_TIMESTAMP"`
}
AuditLog represents an audit trail entry in the system
type AuditLogDetails ¶ added in v0.2.0
type AuditLogDetails map[string]interface{}
AuditLogDetails is a custom type for storing audit log details as JSON
func (*AuditLogDetails) Scan ¶ added in v0.2.0
func (d *AuditLogDetails) Scan(value interface{}) error
Scan implements the sql.Scanner interface
type AuthProvider ¶ added in v0.2.0
type AuthProvider struct {
ID uint `gorm:"primarykey" json:"id"`
Name string `gorm:"not null" json:"name"`
Type ProviderType `gorm:"not null" json:"type"`
Enabled *bool `gorm:"default:true" json:"enabled"`
Description string `json:"description"`
ProviderURL string `json:"provider_url"`
ClientID string `json:"client_id"`
ClientSecret string `json:"-"` // Not returned in JSON responses
RedirectURL string `json:"redirect_url"`
Scopes string `json:"scopes"`
AttributeMapping string `json:"attribute_mapping"`
Config string `json:"-"` // Stores provider-specific configuration
IconURL string `json:"icon_url"` // URL to provider icon
SuccessfulLogins int `json:"successful_logins"`
LastUsed sql.NullTime `json:"last_used"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// contains filtered or unexported fields
}
AuthProvider represents an external authentication provider configuration
func (*AuthProvider) GetConfig ¶ added in v0.2.0
func (p *AuthProvider) GetConfig() (map[string]interface{}, error)
GetConfig returns the unmarshalled configuration data
func (*AuthProvider) GetEnabled ¶ added in v0.2.4
func (p *AuthProvider) GetEnabled() bool
GetEnabled returns the value of Enabled with a default if nil
func (*AuthProvider) SetConfig ¶ added in v0.2.0
func (p *AuthProvider) SetConfig(data map[string]interface{}) error
SetConfig sets the configuration data and marshals it to JSON
func (*AuthProvider) SetEnabled ¶ added in v0.2.4
func (p *AuthProvider) SetEnabled(value bool)
SetEnabled sets the Enabled field
type DB ¶
func Initialize ¶
func ReopenWithoutMigrations ¶ added in v0.2.0
ReopenWithoutMigrations reopens the database connection without running migrations This should be used when temporarily closing and reopening the database
func (*DB) AssignRoleToUser ¶ added in v0.2.0
AssignRoleToUser assigns a role to a user, handling the join table
func (*DB) BuildRcloneCommand ¶ added in v0.2.0
BuildRcloneCommand builds an rclone command string with the specified command and flags
func (*DB) CountExternalUserIdentitiesByProviderID ¶ added in v0.2.0
func (db *DB) CountExternalUserIdentitiesByProviderID(ctx context.Context, providerID uint) (int64, error)
CountExternalUserIdentitiesByProviderID counts the number of external user identities for a specific provider
func (*DB) CreateAuthProvider ¶ added in v0.2.0
func (db *DB) CreateAuthProvider(ctx context.Context, provider *AuthProvider) error
CreateAuthProvider creates a new authentication provider
func (*DB) CreateConfigNotification ¶ added in v0.2.0
func (db *DB) CreateConfigNotification( userID uint, configID uint, title string, message string, ) error
CreateConfigNotification creates a notification for a config update
func (*DB) CreateExternalUserIdentity ¶ added in v0.2.0
func (db *DB) CreateExternalUserIdentity(ctx context.Context, identity *ExternalUserIdentity) error
CreateExternalUserIdentity creates a new external user identity
func (*DB) CreateFileMetadata ¶ added in v0.1.7
func (db *DB) CreateFileMetadata(metadata *FileMetadata) error
CreateFileMetadata creates a new file metadata record
func (*DB) CreateJobHistory ¶
func (db *DB) CreateJobHistory(history *JobHistory) error
CreateJobHistory creates a new job history record
func (*DB) CreateJobNotification ¶ added in v0.2.0
func (db *DB) CreateJobNotification( userID uint, jobID uint, jobRunID uint, notificationType NotificationType, title string, message string, ) error
CreateJobNotification creates a notification for a job event
func (*DB) CreateNotificationService ¶ added in v0.2.0
func (db *DB) CreateNotificationService(service *NotificationService) error
CreateNotificationService creates a new notification service
func (*DB) CreatePasswordResetToken ¶
func (db *DB) CreatePasswordResetToken(token *PasswordResetToken) error
CreatePasswordResetToken creates a new password reset token record
func (*DB) CreateRole ¶ added in v0.2.0
CreateRole creates a new role record
func (*DB) CreateSystemNotification ¶ added in v0.2.0
CreateSystemNotification creates a system-wide notification
func (*DB) CreateTransferConfig ¶
func (db *DB) CreateTransferConfig(config *TransferConfig) error
CreateTransferConfig creates a new transfer config record
func (*DB) CreateUser ¶
CreateUser creates a new user record
func (*DB) DeleteAuthProvider ¶ added in v0.2.0
DeleteAuthProvider deletes an authentication provider by ID
func (*DB) DeleteExternalUserIdentity ¶ added in v0.2.0
DeleteExternalUserIdentity deletes an external user identity by ID
func (*DB) DeleteFileMetadata ¶ added in v0.1.7
DeleteFileMetadata deletes file metadata by ID
func (*DB) DeleteNotificationService ¶ added in v0.2.0
DeleteNotificationService deletes a notification service by ID
func (*DB) DeleteRole ¶ added in v0.2.0
DeleteRole deletes a role after checking dependencies and removing assignments
func (*DB) DeleteTransferConfig ¶
DeleteTransferConfig deletes a transfer config record after checking dependencies
func (*DB) GenerateRcloneConfig ¶
func (db *DB) GenerateRcloneConfig(config *TransferConfig) error
GenerateRcloneConfig generates the rclone config file content based on TransferConfig This function now primarily focuses on generating the content string or calling rclone config create
func (*DB) GenerateRcloneConfigWithToken ¶ added in v0.1.10
func (db *DB) GenerateRcloneConfigWithToken(config *TransferConfig, token string) error
GenerateRcloneConfigWithToken generates a rclone config file for a transfer config with a provided token Note: This seems partially redundant with StoreGoogleDriveToken and GenerateRcloneConfig. Consolidate if possible.
func (*DB) GetActiveJobs ¶ added in v0.1.8
GetActiveJobs returns all active (enabled) jobs
func (*DB) GetAllAuthProviders ¶ added in v0.2.0
func (db *DB) GetAllAuthProviders(ctx context.Context) ([]AuthProvider, error)
GetAllAuthProviders returns all authentication providers
func (*DB) GetAuthProviderByID ¶ added in v0.2.0
GetAuthProviderByID retrieves an authentication provider by ID
func (*DB) GetAuthProviderByType ¶ added in v0.2.0
func (db *DB) GetAuthProviderByType(ctx context.Context, providerType ProviderType) ([]AuthProvider, error)
GetAuthProviderByType returns authentication providers of a specific type
func (*DB) GetConfigRclonePath ¶
func (db *DB) GetConfigRclonePath(config *TransferConfig) string
GetConfigRclonePath returns the path to the rclone config file for a given transfer config
func (*DB) GetConfigsForJob ¶ added in v0.1.8
func (db *DB) GetConfigsForJob(jobID uint) ([]TransferConfig, error)
GetConfigsForJob returns all transfer configurations associated with a job, in the order specified by ConfigIDs
func (*DB) GetEnabledAuthProviders ¶ added in v0.2.0
func (db *DB) GetEnabledAuthProviders(ctx context.Context) ([]AuthProvider, error)
GetEnabledAuthProviders returns all enabled authentication providers
func (*DB) GetExternalUserIdentitiesByProviderID ¶ added in v0.2.0
func (db *DB) GetExternalUserIdentitiesByProviderID(ctx context.Context, providerID uint) ([]ExternalUserIdentity, error)
GetExternalUserIdentitiesByProviderID returns all external user identities for a specific provider
func (*DB) GetExternalUserIdentity ¶ added in v0.2.0
func (db *DB) GetExternalUserIdentity(ctx context.Context, providerID uint, externalID string) (*ExternalUserIdentity, error)
GetExternalUserIdentity gets an external user identity by provider ID and external ID
func (*DB) GetFileMetadataByHash ¶ added in v0.1.7
func (db *DB) GetFileMetadataByHash(fileHash string) (*FileMetadata, error)
GetFileMetadataByHash retrieves file metadata by file hash
func (*DB) GetFileMetadataByJobAndName ¶ added in v0.1.7
func (db *DB) GetFileMetadataByJobAndName(jobID uint, fileName string) (*FileMetadata, error)
GetFileMetadataByJobAndName retrieves file metadata by job ID and filename
func (*DB) GetGDriveCredentialsFromConfig ¶ added in v0.1.10
func (db *DB) GetGDriveCredentialsFromConfig(config *TransferConfig) (string, string)
GetGDriveCredentialsFromConfig extracts Google Drive client ID and secret from an existing rclone config file
func (*DB) GetJobHistory ¶
func (db *DB) GetJobHistory(jobID uint) ([]JobHistory, error)
GetJobHistory retrieves all history records for a specific job, ordered by start time descending
func (*DB) GetNotificationService ¶ added in v0.2.0
func (db *DB) GetNotificationService(id uint) (*NotificationService, error)
GetNotificationService returns a notification service by ID
func (*DB) GetNotificationServices ¶ added in v0.2.0
func (db *DB) GetNotificationServices(onlyEnabled bool) ([]NotificationService, error)
GetNotificationServices returns notification services, filtered by enabled status if specified
func (*DB) GetPaginatedUserNotifications ¶ added in v0.2.0
func (db *DB) GetPaginatedUserNotifications(userID uint, offset, limit int) ([]UserNotification, error)
GetPaginatedUserNotifications returns paginated notifications for a user
func (*DB) GetPasswordResetToken ¶
func (db *DB) GetPasswordResetToken(token string) (*PasswordResetToken, error)
GetPasswordResetToken retrieves a valid, unused password reset token
func (*DB) GetRcloneCategories ¶ added in v0.2.0
GetRcloneCategories returns all unique categories of rclone commands
func (*DB) GetRcloneCommand ¶ added in v0.2.0
func (db *DB) GetRcloneCommand(id uint) (*RcloneCommand, error)
GetRcloneCommand returns a specific rclone command by ID
func (*DB) GetRcloneCommandByName ¶ added in v0.2.0
func (db *DB) GetRcloneCommandByName(name string) (*RcloneCommand, error)
GetRcloneCommandByName returns a specific rclone command by name
func (*DB) GetRcloneCommandFlag ¶ added in v0.2.0
func (db *DB) GetRcloneCommandFlag(id uint) (*RcloneCommandFlag, error)
GetRcloneCommandFlag returns a specific flag by ID
func (*DB) GetRcloneCommandFlagByName ¶ added in v0.2.0
func (db *DB) GetRcloneCommandFlagByName(commandID uint, name string) (*RcloneCommandFlag, error)
GetRcloneCommandFlagByName returns a specific flag by name for a command
func (*DB) GetRcloneCommandFlags ¶ added in v0.2.0
func (db *DB) GetRcloneCommandFlags(commandID uint) ([]RcloneCommandFlag, error)
GetRcloneCommandFlags returns all flags for a specific command
func (*DB) GetRcloneCommandFlagsMap ¶ added in v0.2.0
func (db *DB) GetRcloneCommandFlagsMap(commandID uint) (map[uint]RcloneCommandFlag, error)
GetRcloneCommandFlagsMap returns all flags for a specific command as a map keyed by flag ID
func (*DB) GetRcloneCommandUsage ¶ added in v0.2.0
GetRcloneCommandUsage returns a basic usage example for a command with its required flags
func (*DB) GetRcloneCommandWithFlags ¶ added in v0.2.0
func (db *DB) GetRcloneCommandWithFlags(commandID uint) (*RcloneCommand, error)
GetRcloneCommandWithFlags returns a command with all its flags
func (*DB) GetRcloneCommands ¶ added in v0.2.0
func (db *DB) GetRcloneCommands() ([]RcloneCommand, error)
GetRcloneCommands returns all rclone commands
func (*DB) GetRcloneCommandsByAdvanced ¶ added in v0.2.0
func (db *DB) GetRcloneCommandsByAdvanced(isAdvanced bool) ([]RcloneCommand, error)
GetRcloneCommandsByAdvanced returns commands filtered by their advanced status
func (*DB) GetRcloneCommandsInCategory ¶ added in v0.2.0
func (db *DB) GetRcloneCommandsInCategory(category string) ([]RcloneCommand, error)
GetRcloneCommandsInCategory returns all commands in a specific category
func (*DB) GetRoleByName ¶ added in v0.2.0
GetRoleByName retrieves a role by name, preloading permissions
func (*DB) GetTransferConfig ¶
func (db *DB) GetTransferConfig(id uint) (*TransferConfig, error)
GetTransferConfig retrieves a single transfer config by ID
func (*DB) GetTransferConfigs ¶
func (db *DB) GetTransferConfigs(userID uint) ([]TransferConfig, error)
GetTransferConfigs retrieves all transfer configs for a user
func (*DB) GetUnreadNotificationCount ¶ added in v0.2.0
GetUnreadNotificationCount returns the count of unread notifications for a user
func (*DB) GetUserByEmail ¶
GetUserByEmail retrieves a user by their email address
func (*DB) GetUserByID ¶
GetUserByID retrieves a user by their ID
func (*DB) GetUserNotificationCount ¶ added in v0.2.0
GetUserNotificationCount returns the total count of notifications for a user
func (*DB) GetUserNotifications ¶ added in v0.2.0
func (db *DB) GetUserNotifications(userID uint, limit int) ([]UserNotification, error)
GetUserNotifications returns the latest notifications for a user
func (*DB) GetUserRoles ¶ added in v0.2.0
GetUserRoles retrieves all roles assigned to a specific user ID
func (*DB) MarkAllNotificationsAsRead ¶ added in v0.2.0
MarkAllNotificationsAsRead marks all notifications for a user as read
func (*DB) MarkNotificationAsRead ¶ added in v0.2.0
MarkNotificationAsRead marks a notification as read
func (*DB) MarkPasswordResetTokenAsUsed ¶
MarkPasswordResetTokenAsUsed marks a password reset token as used
func (*DB) RenderRcloneCommandHelp ¶ added in v0.2.0
RenderRcloneCommandHelp generates a help text for a command with its flags
func (*DB) SearchRcloneCommands ¶ added in v0.2.0
func (db *DB) SearchRcloneCommands(query string) ([]RcloneCommand, error)
SearchRcloneCommands searches for commands by name or description
func (*DB) StoreGoogleDriveToken ¶ added in v0.1.10
StoreGoogleDriveToken stores the Google Drive auth token for a config
func (*DB) UnassignRoleFromUser ¶ added in v0.2.0
UnassignRoleFromUser removes a role from a user, handling the join table
func (*DB) UpdateAuthProvider ¶ added in v0.2.0
func (db *DB) UpdateAuthProvider(ctx context.Context, provider *AuthProvider) error
UpdateAuthProvider updates an existing authentication provider
func (*DB) UpdateAuthProviderLastUsed ¶ added in v0.2.0
UpdateAuthProviderLastUsed updates the last used timestamp and increments the successful logins counter
func (*DB) UpdateExternalUserIdentity ¶ added in v0.2.0
func (db *DB) UpdateExternalUserIdentity(ctx context.Context, identity *ExternalUserIdentity) error
UpdateExternalUserIdentity updates an existing external user identity
func (*DB) UpdateJobHistory ¶
func (db *DB) UpdateJobHistory(history *JobHistory) error
UpdateJobHistory updates an existing job history record
func (*DB) UpdateJobStatus ¶
UpdateJobStatus updates the LastRun and NextRun fields of a job
func (*DB) UpdateNotificationService ¶ added in v0.2.0
func (db *DB) UpdateNotificationService(service *NotificationService) error
UpdateNotificationService updates an existing notification service
func (*DB) UpdateRole ¶ added in v0.2.0
UpdateRole updates an existing role record
func (*DB) UpdateTransferConfig ¶
func (db *DB) UpdateTransferConfig(config *TransferConfig) error
UpdateTransferConfig updates an existing transfer config record
func (*DB) UpdateUser ¶
UpdateUser updates an existing user record
type ExternalUserIdentity ¶ added in v0.2.0
type ExternalUserIdentity struct {
ID uint `gorm:"primarykey" json:"id"`
UserID uint `gorm:"not null" json:"user_id"`
ProviderID uint `gorm:"not null" json:"provider_id"`
ProviderType ProviderType `gorm:"not null" json:"provider_type"`
ExternalID string `gorm:"not null" json:"external_id"`
Email string `gorm:"not null" json:"email"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
Groups string `json:"groups"` // JSON array of groups
LastLogin sql.NullTime `json:"last_login"`
ProviderData string `json:"-"` // Raw data from provider
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Foreign key relationships
User User `gorm:"foreignKey:UserID" json:"-"`
Provider AuthProvider `gorm:"foreignKey:ProviderID" json:"-"`
// contains filtered or unexported fields
}
ExternalUserIdentity represents a user identity from an external authentication provider
func (*ExternalUserIdentity) GetGroups ¶ added in v0.2.0
func (e *ExternalUserIdentity) GetGroups() ([]string, error)
GetGroups returns the unmarshalled groups
func (*ExternalUserIdentity) GetProviderData ¶ added in v0.2.0
func (e *ExternalUserIdentity) GetProviderData() (map[string]interface{}, error)
GetProviderData returns the unmarshalled provider data
func (*ExternalUserIdentity) SetGroups ¶ added in v0.2.0
func (e *ExternalUserIdentity) SetGroups(groups []string) error
SetGroups sets the groups and marshals them to JSON
func (*ExternalUserIdentity) SetProviderData ¶ added in v0.2.0
func (e *ExternalUserIdentity) SetProviderData(data map[string]interface{}) error
SetProviderData sets the provider data and marshals it to JSON
type FileMetadata ¶ added in v0.1.7
type FileMetadata struct {
ID uint `gorm:"primarykey"`
JobID uint `gorm:"not null;index"`
Job Job `gorm:"foreignkey:JobID"`
ConfigID uint `gorm:"default:0"` // The specific config ID this file was processed with
FileName string `gorm:"not null"`
OriginalPath string `gorm:"not null"`
FileSize int64 `gorm:"not null"`
FileHash string `gorm:"index"` // MD5 or other hash for file identity
CreationTime time.Time
ModTime time.Time
ProcessedTime time.Time `gorm:"not null"`
DestinationPath string `gorm:"not null"`
Status string `gorm:"not null"` // processed, archived, deleted, etc.
ErrorMessage string
CreatedAt time.Time
UpdatedAt time.Time
}
FileMetadata stores information about processed files
type Job ¶
type Job struct {
ID uint `gorm:"primarykey"`
Name string `form:"name"`
ConfigID uint `gorm:"not null" form:"config_id"`
Config TransferConfig `gorm:"foreignkey:ConfigID"`
ConfigIDs string `gorm:"column:config_ids"` // Comma-separated list of config IDs
Schedule string `gorm:"not null" form:"schedule"`
Enabled *bool `gorm:"default:true" form:"enabled"`
LastRun *time.Time
NextRun *time.Time
// Webhook notification fields
WebhookEnabled *bool `gorm:"default:false" form:"webhook_enabled"`
WebhookURL string `form:"webhook_url"`
WebhookSecret string `form:"webhook_secret"`
WebhookHeaders string `form:"webhook_headers"` // JSON-encoded headers
NotifyOnSuccess *bool `gorm:"default:true" form:"notify_on_success"`
NotifyOnFailure *bool `gorm:"default:true" form:"notify_on_failure"`
CreatedBy uint
User User `gorm:"foreignkey:CreatedBy"`
CreatedAt time.Time
UpdatedAt time.Time
}
Job represents a scheduled transfer task
func (*Job) GetConfigIDsAsStrings ¶ added in v0.1.8
GetConfigIDsAsStrings returns the list of config IDs as strings for template rendering
func (*Job) GetConfigIDsList ¶ added in v0.1.8
GetConfigIDsList returns the list of config IDs as integers
func (*Job) GetEnabled ¶ added in v0.1.10
GetEnabled returns the value of Enabled with a default if nil
func (*Job) GetNotifyOnFailure ¶ added in v0.1.10
GetNotifyOnFailure returns the value of NotifyOnFailure with a default if nil
func (*Job) GetNotifyOnSuccess ¶ added in v0.1.10
GetNotifyOnSuccess returns the value of NotifyOnSuccess with a default if nil
func (*Job) GetWebhookEnabled ¶ added in v0.1.10
GetWebhookEnabled returns the value of WebhookEnabled with a default if nil
func (*Job) SetConfigIDsList ¶ added in v0.1.8
SetConfigIDsList sets the config IDs from a slice of uint
func (*Job) SetEnabled ¶ added in v0.1.10
SetEnabled sets the Enabled field
func (*Job) SetNotifyOnFailure ¶ added in v0.1.10
SetNotifyOnFailure sets the NotifyOnFailure field
func (*Job) SetNotifyOnSuccess ¶ added in v0.1.10
SetNotifyOnSuccess sets the NotifyOnSuccess field
func (*Job) SetWebhookEnabled ¶ added in v0.1.10
SetWebhookEnabled sets the WebhookEnabled field
type JobHistory ¶
type JobHistory struct {
ID uint `gorm:"primarykey"`
JobID uint `gorm:"not null"`
Job Job `gorm:"foreignkey:JobID"`
ConfigID uint `gorm:"default:0"` // The specific config ID this history entry is for
StartTime time.Time `gorm:"not null"`
EndTime *time.Time
Status string `gorm:"not null"`
BytesTransferred int64
FilesTransferred int
ErrorMessage string
CreatedAt time.Time
UpdatedAt time.Time
}
JobHistory records the execution history of a job
type NotificationService ¶ added in v0.2.0
type NotificationService struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null"`
Type string `json:"type" gorm:"not null"` // email, webhook
IsEnabled *bool `json:"is_enabled" gorm:"default:true"`
Config map[string]string `json:"config" gorm:"-"`
ConfigJSON string `json:"-" gorm:"column:config"`
Description string `json:"description"`
EventTriggers []string `json:"event_triggers" gorm:"-"`
EventTriggersJSON string `json:"-" gorm:"column:event_triggers;default:'[]'"`
PayloadTemplate string `json:"payload_template" gorm:"column:payload_template"`
SecretKey string `json:"secret_key" gorm:"column:secret_key"`
RetryPolicy string `json:"retry_policy" gorm:"column:retry_policy;default:'simple'"`
LastUsed time.Time `json:"last_used" gorm:"column:last_used"`
SuccessCount int `json:"success_count" gorm:"column:success_count;default:0"`
FailureCount int `json:"failure_count" gorm:"column:failure_count;default:0"`
CreatedBy uint `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
NotificationService represents a notification service configuration
func (*NotificationService) AfterFind ¶ added in v0.2.0
func (n *NotificationService) AfterFind(tx *gorm.DB) error
AfterFind converts JSON strings back to Config map and EventTriggers
func (*NotificationService) BeforeSave ¶ added in v0.2.0
func (n *NotificationService) BeforeSave(tx *gorm.DB) error
BeforeSave converts Config map and EventTriggers to JSON strings for storage
func (*NotificationService) GetIsEnabled ¶ added in v0.2.4
func (n *NotificationService) GetIsEnabled() bool
GetIsEnabled returns the value of IsEnabled with a default if nil
func (*NotificationService) SetIsEnabled ¶ added in v0.2.4
func (n *NotificationService) SetIsEnabled(value bool)
SetIsEnabled sets the IsEnabled field
type NotificationType ¶ added in v0.2.0
type NotificationType string
NotificationType defines the type of notification
const ( NotificationJobStart NotificationType = "job_start" NotificationJobComplete NotificationType = "job_complete" NotificationJobFail NotificationType = "job_fail" NotificationConfigUpdate NotificationType = "config_update" NotificationSystemAlert NotificationType = "system_alert" )
type PasswordHistory ¶
type PasswordHistory struct {
ID uint `gorm:"primarykey"`
UserID uint `gorm:"not null"`
User User `gorm:"foreignkey:UserID"`
PasswordHash string `gorm:"not null"`
CreatedAt time.Time
}
PasswordHistory stores previous passwords for a user
type PasswordResetToken ¶
type PasswordResetToken struct {
ID uint `gorm:"primarykey"`
UserID uint `gorm:"not null"`
User User `gorm:"foreignkey:UserID"`
Token string `gorm:"not null"`
ExpiresAt time.Time `gorm:"not null"`
Used *bool `gorm:"default:false"`
CreatedAt time.Time
UpdatedAt time.Time
}
PasswordResetToken stores tokens for password reset requests
func (*PasswordResetToken) GetUsed ¶ added in v0.1.10
func (t *PasswordResetToken) GetUsed() bool
GetUsed returns the value of Used with a default if nil
func (*PasswordResetToken) SetUsed ¶ added in v0.1.10
func (t *PasswordResetToken) SetUsed(value bool)
SetUsed sets the Used field
type Permissions ¶ added in v0.2.0
type Permissions []string
Permissions is a custom type for storing permissions as a JSON array
func (*Permissions) Scan ¶ added in v0.2.0
func (p *Permissions) Scan(value interface{}) error
Scan implements the sql.Scanner interface
type ProviderType ¶ added in v0.2.0
type ProviderType string
ProviderType represents the type of authentication provider
const ( // ProviderTypeAuthentik represents an Authentik authentication provider ProviderTypeAuthentik ProviderType = "authentik" // ProviderTypeOIDC represents an OpenID Connect authentication provider ProviderTypeOIDC ProviderType = "oidc" // ProviderTypeSAML represents a SAML authentication provider ProviderTypeSAML ProviderType = "saml" // ProviderTypeOAuth2 represents an OAuth2 authentication provider ProviderTypeOAuth2 ProviderType = "oauth2" )
type RcloneCommand ¶ added in v0.2.0
type RcloneCommand struct {
ID uint `gorm:"primarykey"`
Name string `gorm:"not null;uniqueIndex"`
Description string `gorm:"not null"`
Category string `gorm:"not null;index"`
IsAdvanced bool `gorm:"not null;default:false"`
Flags []RcloneCommandFlag `gorm:"foreignKey:CommandID;constraint:OnDelete:CASCADE"`
CreatedAt time.Time `gorm:"not null"`
}
RcloneCommand represents a command available in rclone
type RcloneCommandFlag ¶ added in v0.2.0
type RcloneCommandFlag struct {
ID uint `gorm:"primarykey"`
CommandID uint `gorm:"not null;index"`
Command RcloneCommand `gorm:"foreignKey:CommandID"`
Name string `gorm:"not null;index"`
ShortName string
Description string `gorm:"not null"`
DataType string `gorm:"not null"` // string, int, bool, etc.
IsRequired bool `gorm:"not null;default:false"`
DefaultValue string
CreatedAt time.Time `gorm:"not null"`
}
RcloneCommandFlag represents a flag that can be used with an rclone command
func (*RcloneCommandFlag) GetUsageExample ¶ added in v0.2.0
func (flag *RcloneCommandFlag) GetUsageExample() string
GetUsageExample returns a human-readable usage example for a flag
type Role ¶ added in v0.2.0
type Role struct {
gorm.Model
Name string `gorm:"size:255;not null;unique"`
Description string `gorm:"type:text"`
Permissions Permissions `gorm:"type:text"`
Users []User `gorm:"many2many:user_roles;"`
}
Role represents a role in the system with associated permissions
func (*Role) AddPermission ¶ added in v0.2.0
AddPermission adds a permission to the role if it doesn't already exist
func (*Role) AfterCreate ¶ added in v0.2.0
AfterCreate is a GORM hook that runs after creating the role
func (*Role) AfterUpdate ¶ added in v0.2.0
AfterUpdate is a GORM hook that runs after updating the role
func (*Role) AssignToUser ¶ added in v0.2.0
AssignToUser assigns this role to a user
func (*Role) BeforeDelete ¶ added in v0.2.0
BeforeDelete is a GORM hook that runs before deleting the role
func (*Role) BeforeSave ¶ added in v0.2.0
BeforeSave is a GORM hook that runs before saving the role
func (*Role) GetPermissions ¶ added in v0.2.0
GetPermissions returns the role's permissions
func (*Role) HasPermission ¶ added in v0.2.0
HasPermission checks if the role has a specific permission
func (*Role) IsSystemRole ¶ added in v0.2.0
IsSystemRole checks if this is a system-defined role that shouldn't be modified
func (*Role) RemovePermission ¶ added in v0.2.0
RemovePermission removes a permission from the role
func (*Role) SetPermissions ¶ added in v0.2.0
SetPermissions sets the role's permissions
func (*Role) UnassignFromUser ¶ added in v0.2.0
UnassignFromUser removes this role from a user
type TransferConfig ¶
type TransferConfig struct {
ID uint `gorm:"primarykey"`
Name string `gorm:"not null" form:"name"`
SourceType string `gorm:"not null" form:"source_type"`
SourcePath string `gorm:"not null" form:"source_path"`
SourceHost string `form:"source_host"`
SourcePort int `gorm:"default:22" form:"source_port"`
SourceUser string `form:"source_user"`
SourcePassword string `form:"source_password" gorm:"-"` // Not stored in DB, only used for form
SourceKeyFile string `form:"source_key_file"`
// S3 source fields
SourceBucket string `form:"source_bucket"`
SourceRegion string `form:"source_region"`
SourceAccessKey string `form:"source_access_key"`
SourceSecretKey string `form:"source_secret_key" gorm:"-"` // Not stored in DB, only used for form
SourceEndpoint string `form:"source_endpoint"`
// SMB source fields
SourceDomain string `form:"source_domain"`
// FTP source fields
SourcePassiveMode *bool `gorm:"default:true" form:"source_passive_mode"` // Already a pointer, no change needed here
// OneDrive and Google Drive source fields
SourceClientID string `form:"source_client_id"`
SourceClientSecret string `form:"source_client_secret" gorm:"-"` // Not stored in DB, only used for form
SourceDriveID string `form:"source_drive_id"` // For OneDrive
SourceTeamDrive string `form:"source_team_drive"` // For Google Drive
// Google Photos source fields
SourceReadOnly *bool `form:"source_read_only"` // For Google Photos
SourceStartYear int `form:"source_start_year"` // For Google Photos
SourceIncludeArchived *bool `form:"source_include_archived"` // For Google Photos
// General fields
FilePattern string `gorm:"default:'*'" form:"file_pattern"`
OutputPattern string `form:"output_pattern"` // Pattern for output filenames with date variables
DestinationType string `gorm:"not null" form:"destination_type"`
DestinationPath string `gorm:"not null" form:"destination_path"`
DestHost string `form:"dest_host"`
DestPort int `gorm:"default:22" form:"dest_port"`
DestUser string `form:"dest_user"`
DestPassword string `form:"dest_password" gorm:"-"` // Not stored in DB, only used for form
DestKeyFile string `form:"dest_key_file"`
// S3 destination fields
DestBucket string `form:"dest_bucket"`
DestRegion string `form:"dest_region"`
DestAccessKey string `form:"dest_access_key"`
DestSecretKey string `form:"dest_secret_key" gorm:"-"` // Not stored in DB, only used for form
DestEndpoint string `form:"dest_endpoint"`
// SMB destination fields
DestDomain string `form:"dest_domain"`
// FTP destination fields
DestPassiveMode *bool `gorm:"default:true" form:"dest_passive_mode"`
// OneDrive and Google Drive destination fields
DestClientID string `form:"dest_client_id"`
DestClientSecret string `form:"dest_client_secret" gorm:"-"` // Not stored in DB, only used for form
DestDriveID string `form:"dest_drive_id"` // For OneDrive
DestTeamDrive string `form:"dest_team_drive"` // For Google Drive
// Google Photos destination fields
DestReadOnly *bool `form:"dest_read_only"` // For Google Photos
DestStartYear int `form:"dest_start_year"` // For Google Photos
DestIncludeArchived *bool `form:"dest_include_archived"` // For Google Photos
// Security fields
UseBuiltinAuthSource *bool `form:"use_builtin_auth_source"` // For Google and other OAuth services
UseBuiltinAuthDest *bool `form:"use_builtin_auth_dest"` // For Google and other OAuth services
GoogleDriveAuthenticated *bool // Whether Google Drive auth is completed
// General fields
ArchivePath string `form:"archive_path"`
ArchiveEnabled *bool `gorm:"default:false" form:"archive_enabled"`
RcloneFlags string `form:"rclone_flags"`
// Rclone command fields
CommandID uint `gorm:"default:1" form:"command_id"` // Default to 'copy' command ID (1)
CommandFlags string `form:"command_flags"` // JSON string of selected flags
CommandFlagValues string `form:"command_flag_values"` // JSON string of flag values by ID
DeleteAfterTransfer *bool `gorm:"default:false" form:"delete_after_transfer"`
SkipProcessedFiles *bool `gorm:"default:true" form:"skip_processed_files"`
MaxConcurrentTransfers int `gorm:"default:4" form:"max_concurrent_transfers"` // Number of concurrent file transfers
CreatedBy uint
User User `gorm:"foreignkey:CreatedBy"`
CreatedAt time.Time
UpdatedAt time.Time
}
TransferConfig holds the configuration for a data transfer operation
func (*TransferConfig) GetArchiveEnabled ¶ added in v0.1.10
func (tc *TransferConfig) GetArchiveEnabled() bool
GetArchiveEnabled returns the value of ArchiveEnabled with a default if nil
func (*TransferConfig) GetDeleteAfterTransfer ¶ added in v0.1.10
func (tc *TransferConfig) GetDeleteAfterTransfer() bool
GetDeleteAfterTransfer returns the value of DeleteAfterTransfer with a default if nil
func (*TransferConfig) GetDestPassiveMode ¶ added in v0.1.10
func (tc *TransferConfig) GetDestPassiveMode() bool
GetDestPassiveMode returns the value of DestPassiveMode with a default if nil
func (*TransferConfig) GetGoogleAuthenticated ¶ added in v0.1.10
func (tc *TransferConfig) GetGoogleAuthenticated() bool
GetGoogleAuthenticated is an alias for GetGoogleDriveAuthenticated for better semantics when working with Google Photos
func (*TransferConfig) GetGoogleDriveAuthenticated ¶ added in v0.1.10
func (tc *TransferConfig) GetGoogleDriveAuthenticated() bool
GetGoogleDriveAuthenticated returns whether the transfer config has been authenticated with Google Drive
func (*TransferConfig) GetSkipProcessedFiles ¶ added in v0.1.8
func (tc *TransferConfig) GetSkipProcessedFiles() bool
GetSkipProcessedFiles returns the value of SkipProcessedFiles with a default if nil
func (*TransferConfig) GetSourcePassiveMode ¶ added in v0.1.10
func (tc *TransferConfig) GetSourcePassiveMode() bool
GetSourcePassiveMode returns the value of SourcePassiveMode with a default if nil
func (*TransferConfig) GetUseBuiltinAuthDest ¶ added in v0.1.11
func (tc *TransferConfig) GetUseBuiltinAuthDest() bool
GetUseBuiltinAuthDest returns the value of UseBuiltinAuthDest with a default if nil
func (*TransferConfig) GetUseBuiltinAuthSource ¶ added in v0.1.11
func (tc *TransferConfig) GetUseBuiltinAuthSource() bool
GetUseBuiltinAuthSource returns the value of UseBuiltinAuthSource with a default if nil
func (*TransferConfig) SetArchiveEnabled ¶ added in v0.1.10
func (tc *TransferConfig) SetArchiveEnabled(value bool)
SetArchiveEnabled sets the ArchiveEnabled field
func (*TransferConfig) SetDeleteAfterTransfer ¶ added in v0.1.10
func (tc *TransferConfig) SetDeleteAfterTransfer(value bool)
SetDeleteAfterTransfer sets the DeleteAfterTransfer field
func (*TransferConfig) SetDestPassiveMode ¶ added in v0.1.10
func (tc *TransferConfig) SetDestPassiveMode(value bool)
SetDestPassiveMode sets the DestPassiveMode field
func (*TransferConfig) SetGoogleAuthenticated ¶ added in v0.1.10
func (tc *TransferConfig) SetGoogleAuthenticated(value bool)
SetGoogleAuthenticated is an alias for SetGoogleDriveAuthenticated for better semantics when working with Google Photos
func (*TransferConfig) SetGoogleDriveAuthenticated ¶ added in v0.1.10
func (tc *TransferConfig) SetGoogleDriveAuthenticated(value bool)
SetGoogleDriveAuthenticated sets the Google Drive authentication status
func (*TransferConfig) SetSkipProcessedFiles ¶ added in v0.1.8
func (tc *TransferConfig) SetSkipProcessedFiles(value bool)
SetSkipProcessedFiles sets the SkipProcessedFiles field
func (*TransferConfig) SetSourcePassiveMode ¶ added in v0.1.10
func (tc *TransferConfig) SetSourcePassiveMode(value bool)
SetSourcePassiveMode sets the SourcePassiveMode field
func (*TransferConfig) SetUseBuiltinAuthDest ¶ added in v0.1.11
func (tc *TransferConfig) SetUseBuiltinAuthDest(value bool)
SetUseBuiltinAuthDest sets the UseBuiltinAuthDest field
func (*TransferConfig) SetUseBuiltinAuthSource ¶ added in v0.1.11
func (tc *TransferConfig) SetUseBuiltinAuthSource(value bool)
SetUseBuiltinAuthSource sets the UseBuiltinAuthSource field
type User ¶
type User struct {
ID uint `gorm:"primarykey"`
Email string `gorm:"unique;not null"`
PasswordHash string `gorm:"not null"`
IsAdmin *bool `gorm:"default:false"`
LastPasswordChange time.Time
FailedLoginAttempts int `gorm:"default:0"`
AccountLocked *bool `gorm:"default:false"`
LockoutUntil *time.Time
Theme string `gorm:"default:'light'"`
TwoFactorSecret string `gorm:"type:varchar(32)"`
TwoFactorEnabled bool `gorm:"default:false"`
BackupCodes string `gorm:"type:text"` // Comma-separated backup codes
Roles []Role `gorm:"many2many:user_roles"`
CreatedAt time.Time
UpdatedAt time.Time
}
User represents a user account in the system
func (*User) AssignRole ¶ added in v0.2.0
AssignRole assigns a role to the user
func (*User) CheckPassword ¶ added in v0.2.0
CheckPassword verifies if the provided password matches the stored hash
func (*User) GetAccountLocked ¶ added in v0.1.10
GetAccountLocked returns the value of AccountLocked with a default if nil
func (*User) GetIsAdmin ¶ added in v0.1.10
GetIsAdmin returns the value of IsAdmin with a default if nil
func (*User) GetRoles ¶ added in v0.2.0
GetRoles returns all roles assigned to the user Note: This requires preloading Roles when fetching the user
func (*User) HasPermission ¶ added in v0.2.0
HasPermission checks if the user has a specific permission through any of their roles
func (*User) SetAccountLocked ¶ added in v0.1.10
SetAccountLocked sets the AccountLocked field
func (*User) SetIsAdmin ¶ added in v0.1.10
SetIsAdmin sets the IsAdmin field
func (*User) SetPassword ¶ added in v0.2.0
SetPassword sets the user's password with secure hashing
type UserNotification ¶ added in v0.2.0
type UserNotification struct {
ID uint `json:"id" gorm:"primaryKey"`
UserID uint `json:"user_id" gorm:"index"`
Type NotificationType `json:"type"`
Title string `json:"title"`
Message string `json:"message"`
Link string `json:"link"`
JobID uint `json:"job_id,omitempty"`
JobRunID uint `json:"job_run_id,omitempty"`
ConfigID uint `json:"config_id,omitempty"`
IsRead bool `json:"is_read" gorm:"default:false"`
CreatedAt time.Time `json:"created_at"`
}
UserNotification represents a notification shown to users in the UI