port

package
v0.0.0-...-fd201ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLRepository

type ACLRepository interface {
	AssignRolesToUser(userID uint64, roleIDs []uint64) error
}

type ACLService

type ACLService interface {
	CheckAccess(
		ctx context.Context,
		uow AuthUnitOfWork,
		userUUID uuid.UUID,
		requiredPermissions ...domain.PermissionKeyType,
	) (bool, uint64, error)
	AssignUserRoleToUser(uow AuthUnitOfWork, userID uint64) error
}

type AuthCache

type AuthCache interface {
	SetTokenState(ctx context.Context, key string, value string, expiration time.Duration) error
	GetTokenState(ctx context.Context, key string) (string, error)
}

type AuthService

type AuthService interface {
	GenerateToken(userUUIDStr string) (*string, error)
	LogoutToken(ctx context.Context, jti string, exp int64) error
}

type AuthUnitOfWork

type AuthUnitOfWork interface {
	UnitOfWork

	RoleRepository() RoleRepository
	PermissionRepository() PermissionRepository
	ACLRepository() ACLRepository
}

type Driver

type Driver interface {
	Close()
	Produce(name string, message interface{}, delaySeconds int64) error
	RegisterConsumer(name string, callback func(message []byte) error) error
}

type EmailSender

type EmailSender interface {
	Send(to string, name string, subject string, body string) error
}

type Event

type Event interface {
	Name() string
	Publish(message interface{})
	Consume(message []byte) error
	Register()
}

type OTPCache

type OTPCache interface {
	Set(ctx context.Context, key string, value *domain.OTP, expiration time.Duration) error
	Get(ctx context.Context, key string) (*domain.OTP, error)
}

type OTPCacheService

type OTPCacheService interface {
	Set(ctx context.Context, key string, otp string) error
	Validate(ctx context.Context, key string, otp string) error
	Used(ctx context.Context, key string) error

	SetForgetPassword(ctx context.Context, key string, otp string) error
	ValidateForgetPassword(ctx context.Context, key string, otp string) error
	UsedForgetPassword(ctx context.Context, key string) error
}

type PermissionRepository

type PermissionRepository interface {
	GetUserPermissionKeys(userID uint64) ([]domain.PermissionKeyType, error)
	List() ([]*domain.Permission, error)
	FilterValidPermissions(uuids []uuid.UUID) ([]uint64, error)
}

type PermissionService

type PermissionService interface {
	List(uow AuthUnitOfWork) ([]*domain.Permission, error)
}

type RoleCache

type RoleCache interface {
	Set(ctx context.Context, key string, value *domain.RoleKeyType, expiration time.Duration) error
	Get(ctx context.Context, key string) (*domain.RoleKeyType, error)
}

type RoleCacheService

type RoleCacheService interface {
	Get(ctx context.Context, key string) (*domain.RoleKeyType, error)
	SetBulk(ctx context.Context, items map[string]domain.RoleKeyType) error
}

type RoleRepository

type RoleRepository interface {
	Create(role domain.Role) error
	GetByUUID(uuid uuid.UUID) (*domain.Role, error)
	List() ([]*domain.Role, error)
	Update(role domain.Role, uuid uuid.UUID) error
	Delete(uuid uuid.UUID, deletedBy uint64) error

	ExistKey(key domain.RoleKeyType) (bool, error)
	GetRoleUser() (domain.Role, error)

	GetPermissions(uuid uuid.UUID) (*domain.Role, error)
	SyncPermissions(roleID uint64, permissionIDs []uint64) error

	GetUserRoleKeys(userID uint64) ([]domain.RoleKeyType, error)
}

type RoleService

type RoleService interface {
	Create(uow AuthUnitOfWork, role domain.Role) error
	Get(uow AuthUnitOfWork, uuidStr string) (*domain.Role, error)
	List(ctx context.Context, uow AuthUnitOfWork) ([]*domain.Role, error)
	Update(ctx context.Context, uow AuthUnitOfWork, role domain.Role, uuidStr string) error
	Delete(uow AuthUnitOfWork, uuidStr string, deletedBy uint64) error

	GetPermissions(uow AuthUnitOfWork, uuidStr string) (*domain.Role, error)
	SyncPermissions(uow AuthUnitOfWork, uuidStr string, permissionUUIDStr []string) error
}

type TOTPCache

type TOTPCache interface {
	Set(ctx context.Context, key string, value string) error
	Get(ctx context.Context, key string) (string, error)
}

type TOTPService

type TOTPService interface {
	Enroll(ctx context.Context, email string) (*domain.TOTPKey, error)
	Enable(ctx context.Context, uow UserUnitOfWork, userID uint64, email string, code string) error
	Disable(ctx context.Context, uow UserUnitOfWork, userID uint64, code string) error
	Get(ctx context.Context, uow UserUnitOfWork, userID uint64, email string) (*domain.TOTPKey, error)
	Verify(passCode string, secret string) (bool, error)
}

type UnitOfWork

type UnitOfWork interface {
	BeginTx(ctx context.Context) error
	Commit() error
	Rollback() error
}

type UserClient

type UserClient interface {
	IsEmailUnique(ctx context.Context, email string) error

	Create(ctx context.Context, user domain.User) (*domain.User, error)

	GetByEmail(ctx context.Context, email string) (*domain.User, error)
	GetByUUID(ctx context.Context, uuidStr string) (*domain.User, error)

	VerifiedEmail(ctx context.Context, email string) error

	MarkWelcomeMessageSent(ctx context.Context, ID uint64) error
	UpdateGoogleID(ctx context.Context, ID uint64, googleID string) error
	UpdateLastLoginTime(ctx context.Context, ID uint64) error
	UpdatePassword(ctx context.Context, ID uint64, password string) error
}

type UserRepository

type UserRepository interface {
	GetByUUID(uuid uuid.UUID) (*domain.User, error)
	GetByID(id uint64) (*domain.User, error)
	IsEmailUnique(email string) (bool, error)
	GetByEmail(email string) (*domain.User, error)
	List() ([]*domain.User, error)
	Save(user *domain.User) (*domain.User, error)
	VerifiedEmail(email string) error
	MarkWelcomeMessageSent(id uint64) error
	UpdateGoogleID(id uint64, googleID string) error
	UpdateLastLoginTime(id uint64) error
	UpdatePassword(id uint64, password string) error
	UpdateTOTPSecret(id uint64, secret *string) error
	GetTOTPSecret(id uint64) (*string, error)
}

UserRepository is an interface for interacting with user-related data

type UserService

type UserService interface {
	GetByUUID(uow UserUnitOfWork, uuidStr string) (*domain.User, error)
	GetByID(uow UserUnitOfWork, id uint64) (*domain.User, error)
	IsEmailUnique(uow UserUnitOfWork, email string) error
	GetByEmail(uow UserUnitOfWork, email string) (*domain.User, error)
	List(uow UserUnitOfWork) ([]*domain.User, error)
	Create(uow UserUnitOfWork, user domain.User) (*domain.User, error)
	VerifiedEmail(uow UserUnitOfWork, email string) error
	MarkWelcomeMessageSent(uow UserUnitOfWork, id uint64) error
	UpdateGoogleID(uow UserUnitOfWork, id uint64, googleID string) error
	UpdateLastLoginTime(uow UserUnitOfWork, id uint64) error
	UpdatePassword(uow UserUnitOfWork, id uint64, password string) error
}

UserService is an interface for interacting with user-related business logic

type UserUnitOfWork

type UserUnitOfWork interface {
	UnitOfWork

	UserRepository() UserRepository
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL