Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRoleNotFound = errors.New("role not found")
)
View Source
var (
ErrSecretNotFound = errors.New("secret not found")
)
View Source
var (
ErrSettingNotFound = errors.New("setting not found")
)
View Source
var (
ErrUserNotFound = errors.New("user not found")
)
Functions ¶
This section is empty.
Types ¶
type DecryptedSecret ¶
type GlobalSettingsRepository ¶
type GlobalSettingsRepository interface {
// StoreSetting stores a string value for a given key
StoreSetting(ctx context.Context, key string, value string) error
// StoreSettings stores multiple key-value pairs in a single query
StoreSettings(ctx context.Context, settings map[string]string) error
// GetSetting retrieves a string value for a given key
GetSetting(ctx context.Context, key string) (string, error)
// GetSettings retrieves values for multiple keys
GetSettings(ctx context.Context, keys ...string) (map[string]string, error)
// DeleteSetting deletes a single setting by its key
DeleteSetting(ctx context.Context, key string) error
// DeleteSettings deletes multiple settings by their keys
DeleteSettings(ctx context.Context, keys ...string) error
}
GlobalSettingsRepository defines the interface for global settings storage
func NewGlobalSettingsRepository ¶
func NewGlobalSettingsRepository(pool *pgxpool.Pool) GlobalSettingsRepository
type RolesRepository ¶
type RolesRepository interface {
CreateRole(ctx context.Context, name string, color string) (int, error)
GetRoleByID(ctx context.Context, id int) (*Role, error)
GetRoleByName(ctx context.Context, name string) (*Role, error)
ListRoles(ctx context.Context) ([]Role, error)
GetRolesByIDs(ctx context.Context, ids []int) ([]Role, error)
DeleteRole(ctx context.Context, id int) error
}
func NewRolesRepository ¶
func NewRolesRepository(pool *pgxpool.Pool) RolesRepository
type SecretsAccessRepository ¶
type SecretsAccessRepository interface {
GrantUserAccess(ctx context.Context, secretPath string, userID int) error
GrantUsersAccess(ctx context.Context, secretPath string, userIDs []int) error
GrantRoleAccess(ctx context.Context, secretPath string, roleID int) error
GrantRolesAccess(ctx context.Context, secretPath string, roleIDs []int) error
RevokeUserAccess(ctx context.Context, secretPath string, userID int) error
RevokeRoleAccess(ctx context.Context, secretPath string, roleID int) error
GetAccessesBySecretPath(ctx context.Context, secretPath string) (userIDs []int, roleIDs []int, err error)
}
func NewSecretsAccessRepository ¶
func NewSecretsAccessRepository(pool *pgxpool.Pool) SecretsAccessRepository
type SecretsRepository ¶
type SecretsRepository interface {
CreateSecret(ctx context.Context, keyManager *crypto.KeyManager, path string, ownerUserId int, value string) (int, error)
GetSecretByPath(ctx context.Context, keyManager *crypto.KeyManager, path string) (*DecryptedSecret, error)
ListSecretsForUser(ctx context.Context, userID int) ([]Secret, error)
DeleteSecret(ctx context.Context, path string) error
HasAccess(ctx context.Context, secretPath string, userID *int, roleIDs []int) (bool, error)
UpdateSecret(ctx context.Context, keyManager *crypto.KeyManager, path string, newValue string) error
}
func NewSecretsRepository ¶
func NewSecretsRepository(pool *pgxpool.Pool) SecretsRepository
type UserRolesRepository ¶
type UserRolesRepository interface {
AssignRoleToUser(ctx context.Context, userID, roleID int) error
RemoveRoleFromUser(ctx context.Context, userID, roleID int) error
GetUserRoleIDs(ctx context.Context, userID int) ([]int, error)
}
func NewUserRolesRepository ¶
func NewUserRolesRepository(pool *pgxpool.Pool) UserRolesRepository
type UsersRepository ¶
type UsersRepository interface {
CreateUser(ctx context.Context, username string, hashedPassword string) (int, error)
GetUserByUsername(ctx context.Context, username string) (*User, error)
GetUserByID(ctx context.Context, id int) (*User, error)
GetUsersByIDs(ctx context.Context, ids []int) ([]User, error)
ListUsers(ctx context.Context) ([]User, error)
DeleteUser(ctx context.Context, username string) error
}
func NewUsersRepository ¶
func NewUsersRepository(pool *pgxpool.Pool) UsersRepository
Click to show internal directories.
Click to hide internal directories.