participantuser

package
v0.0.0-...-4780336 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COLLECTION_NAME_PARTICIPANT_USERS   = "users"
	COLLECTION_NAME_RENEW_TOKENS        = "renewTokens"
	COLLECTION_NAME_OTPS                = "otps"
	COLLECTION_NAME_FAILED_OTP_ATTEMPTS = "failedOtpAttempts"
)

collection names

View Source
const (
	RENEW_TOKEN_GRACE_PERIOD     = 30 // seconds
	RENEW_TOKEN_DEFAULT_LIFETIME = 60 * 60 * 24 * 90
)
View Source
const (
	FAILED_OTP_ATTEMP_WINDOW = 60 * 5
)
View Source
const (
	OTP_TTL = 60 * 15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FailedOtpAttempt

type FailedOtpAttempt struct {
	Timestamp time.Time `json:"timestamp" bson:"timestamp"`
	UserID    string    `json:"userId" bson:"userID"`
}

type ParticipantUserDBService

type ParticipantUserDBService struct {
	DBClient *mongo.Client

	DBNamePrefix string
	InstanceIDs  []string
	// contains filtered or unexported fields
}

func NewParticipantUserDBService

func NewParticipantUserDBService(configs db.DBConfig) (*ParticipantUserDBService, error)

func (*ParticipantUserDBService) AddFailedOtpAttempt

func (dbService *ParticipantUserDBService) AddFailedOtpAttempt(instanceID string, userID string) error

func (*ParticipantUserDBService) AddUser

func (dbService *ParticipantUserDBService) AddUser(instanceID string, user umTypes.User) (id string, err error)

func (*ParticipantUserDBService) CountFailedOtpAttempts

func (dbService *ParticipantUserDBService) CountFailedOtpAttempts(instanceID string, userID string) (int64, error)

func (*ParticipantUserDBService) CountOTP

func (dbService *ParticipantUserDBService) CountOTP(instanceID string, userID string) (int64, error)

func (*ParticipantUserDBService) CountRecentlyCreatedUsers

func (dbService *ParticipantUserDBService) CountRecentlyCreatedUsers(instanceID string, interval int64) (count int64, err error)

func (*ParticipantUserDBService) CreateIndexForFailedOtpAttempts

func (dbService *ParticipantUserDBService) CreateIndexForFailedOtpAttempts(instanceID string) error

func (*ParticipantUserDBService) CreateIndexForOTPs

func (dbService *ParticipantUserDBService) CreateIndexForOTPs(instanceID string) error

func (*ParticipantUserDBService) CreateIndexForParticipantUsers

func (dbService *ParticipantUserDBService) CreateIndexForParticipantUsers(instanceID string) error

func (*ParticipantUserDBService) CreateIndexForRenewTokens

func (dbService *ParticipantUserDBService) CreateIndexForRenewTokens(instanceID string) error

func (*ParticipantUserDBService) CreateOTP

func (dbService *ParticipantUserDBService) CreateOTP(instanceID string, userID string, code string, t userTypes.OTPType, maxOTPCount int64) error

func (*ParticipantUserDBService) CreateRenewToken

func (dbService *ParticipantUserDBService) CreateRenewToken(instanceID string, userID string, token string, lifeTimeInSec int) error

func (*ParticipantUserDBService) DeleteOTP

func (dbService *ParticipantUserDBService) DeleteOTP(instanceID string, userID string, code string) error

func (*ParticipantUserDBService) DeleteOTPs

func (dbService *ParticipantUserDBService) DeleteOTPs(instanceID string, userID string) error

func (*ParticipantUserDBService) DeleteRenewTokenByToken

func (dbService *ParticipantUserDBService) DeleteRenewTokenByToken(instanceID string, token string) error

func (*ParticipantUserDBService) DeleteRenewTokensForUser

func (dbService *ParticipantUserDBService) DeleteRenewTokensForUser(instanceID string, userID string) (int64, error)

func (*ParticipantUserDBService) DeleteUser

func (dbService *ParticipantUserDBService) DeleteUser(instanceID, userID string) error

func (*ParticipantUserDBService) FindAndExecuteOnUsers

func (dbService *ParticipantUserDBService) FindAndExecuteOnUsers(
	ctx context.Context,
	instanceID string,
	filter bson.M,
	sort bson.M,
	returnOnError bool,
	fn func(user umTypes.User, args ...interface{}) error,
	args ...interface{},
) error

func (*ParticipantUserDBService) FindAndUpdateRenewToken

func (dbService *ParticipantUserDBService) FindAndUpdateRenewToken(instanceID string, userID string, renewToken string, nextToken string) (rtObj userTypes.RenewToken, err error)

func (*ParticipantUserDBService) FindOTP

func (dbService *ParticipantUserDBService) FindOTP(instanceID string, userID string, code string) (userTypes.OTP, error)

func (*ParticipantUserDBService) FixFieldNameForContactInfos

func (dbService *ParticipantUserDBService) FixFieldNameForContactInfos(instanceID string) error

func (*ParticipantUserDBService) GetLastOTP

func (dbService *ParticipantUserDBService) GetLastOTP(instanceID string, userID string, otpType string) (userTypes.OTP, error)

func (*ParticipantUserDBService) GetUser

func (dbService *ParticipantUserDBService) GetUser(instanceID, objectID string) (umTypes.User, error)

func (*ParticipantUserDBService) GetUserByAccountID

func (dbService *ParticipantUserDBService) GetUserByAccountID(instanceID, accountID string) (umTypes.User, error)

func (*ParticipantUserDBService) GetUserByProfileID

func (dbService *ParticipantUserDBService) GetUserByProfileID(instanceID, profileID string) (umTypes.User, error)

func (*ParticipantUserDBService) ReplaceUser

func (dbService *ParticipantUserDBService) ReplaceUser(instanceID string, updatedUser umTypes.User) (umTypes.User, error)

func (*ParticipantUserDBService) SaveFailedLoginAttempt

func (dbService *ParticipantUserDBService) SaveFailedLoginAttempt(instanceID string, userID string) error

func (*ParticipantUserDBService) SavePasswordResetTrigger

func (dbService *ParticipantUserDBService) SavePasswordResetTrigger(instanceID string, userID string) error

func (*ParticipantUserDBService) UpdateUser

func (dbService *ParticipantUserDBService) UpdateUser(instanceID string, userID string, update bson.M) error

Jump to

Keyboard shortcuts

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