models

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ErrLogEventIsNotSet  = "log event is not set"
	ErrLogEventTypeError = "log event type error"
)
View Source
const (
	LogEventType_LogIn   = 1
	LogEventType_LogOut  = 2 // Self logging out.
	LogEventType_LogOutA = 3 // Logging out by an administrator.
)
View Source
const (
	LogEventTypesCount = 3
)

Variables

This section is empty.

Functions

func CheckLogEvent

func CheckLogEvent(le *LogEvent) (err error)

Types

type ApproveAndRegisterUserParams

type ApproveAndRegisterUserParams struct {
	cmr.CommonParams

	// E-mail address of an approved user.
	Email cm.Email `json:"email"`
}

type ApproveAndRegisterUserResult

type ApproveAndRegisterUserResult = cmr.CommonResultWithSuccess

type BanUserParams

type BanUserParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type BanUserResult

type BanUserResult = cmr.CommonResultWithSuccess

type ChangeEmailParams

type ChangeEmailParams struct {
	cmr.CommonParams

	// Step number.
	StepN cm.StepNumber `json:"stepN"`

	// New e-mail address.
	// Is used on step 1.
	NewEmail cm.Email `json:"newEmail"`

	// Request ID.
	// It protects e-mail changes from being hi-jacked.
	// Is used on step 2.
	RequestId cm.RequestId `json:"requestId"`

	// Authentication data provided for the challenge.
	// Is used on step 2.
	AuthChallengeResponse cmr.AuthChallengeData `json:"authChallengeResponse"`

	// Verification Code for the old e-mail.
	// Is used on step 2.
	VerificationCodeOld cm.VerificationCode `json:"verificationCodeOld"`

	// Verification Code for the new e-mail.
	// Is used on step 2.
	VerificationCodeNew cm.VerificationCode `json:"verificationCodeNew"`

	// Captcha answer.
	// This field is optional and may be used on step 2.
	CaptchaAnswer cm.CaptchaAnswer `json:"captchaAnswer"`
}

type ChangeEmailResult

type ChangeEmailResult struct {
	cmr.CommonResult
	cmr.Success

	// Next required step. If set to zero, no further step is required.
	NextStep cm.StepNumber `json:"nextStep"`

	RequestId     cm.RequestId          `json:"requestId"`
	AuthDataBytes cmr.AuthChallengeData `json:"authDataBytes"`

	// Captcha parameters.
	IsCaptchaNeeded cmb.Flag     `json:"isCaptchaNeeded"`
	CaptchaId       cm.CaptchaId `json:"captchaId"`
}

type ChangePasswordParams

type ChangePasswordParams struct {
	cmr.CommonParams

	// Step number.
	StepN cm.StepNumber `json:"stepN"`

	// New password.
	// Is used on step 1.
	NewPassword cm.Password `json:"newPassword"`

	// Request ID.
	// It protects password changes from being hi-jacked.
	// Is used on step 2.
	RequestId cm.RequestId `json:"requestId"`

	// Authentication data provided for the challenge.
	// Is used on step 2.
	AuthChallengeResponse cmr.AuthChallengeData `json:"authChallengeResponse"`

	// Verification Code.
	// Is used on step 2.
	VerificationCode cm.VerificationCode `json:"verificationCode"`

	// Captcha answer.
	// This field is optional and may be used on step 2.
	CaptchaAnswer cm.CaptchaAnswer `json:"captchaAnswer"`
}

type ChangePasswordResult

type ChangePasswordResult struct {
	cmr.CommonResult
	cmr.Success

	// Next required step. If set to zero, no further step is required.
	NextStep cm.StepNumber `json:"nextStep"`

	RequestId     cm.RequestId          `json:"requestId"`
	AuthDataBytes cmr.AuthChallengeData `json:"authDataBytes"`

	// Captcha parameters.
	IsCaptchaNeeded cmb.Flag     `json:"isCaptchaNeeded"`
	CaptchaId       cm.CaptchaId `json:"captchaId"`
}

type EmailChange

type EmailChange struct {
	Id             cmb.Id
	UserId         cmb.Id
	TimeOfCreation time.Time
	RequestId      *cm.RequestId

	// IP address of a user. B = Byte array.
	UserIPAB net.IP

	AuthDataBytes     cmr.AuthChallengeData
	IsCaptchaRequired cmb.Flag
	CaptchaId         *cm.CaptchaId
	EmailChangeVerificationFlags

	// Old e-mail.
	VerificationCodeOld *cm.VerificationCode
	IsOldEmailSent      cmb.Flag

	// New e-mail.
	NewEmail            cm.Email
	VerificationCodeNew *cm.VerificationCode
	IsNewEmailSent      cmb.Flag
}

func NewEmailChange

func NewEmailChange() (ec *EmailChange)

func NewEmailChangeFromScannableSource

func NewEmailChangeFromScannableSource(src cm.IScannable) (ec *EmailChange, err error)

type EmailChangeVerificationFlags

type EmailChangeVerificationFlags struct {
	IsVerifiedByCaptcha  *cmb.Flag
	IsVerifiedByPassword cmb.Flag
	IsVerifiedByOldEmail cmb.Flag
	IsVerifiedByNewEmail cmb.Flag
}

type GetListOfAllUsersOnPageParams added in v0.0.54

type GetListOfAllUsersOnPageParams struct {
	cmr.CommonParams
	Page cmb.Count `json:"page"`
}

type GetListOfAllUsersOnPageResult added in v0.0.54

type GetListOfAllUsersOnPageResult struct {
	cmr.CommonResult
	UserIds  []cmb.Id      `json:"userIds"`
	PageData *cmr.PageData `json:"pageData,omitempty"`
}

type GetListOfAllUsersParams added in v0.0.16

type GetListOfAllUsersParams struct {
	cmr.CommonParams
}

type GetListOfAllUsersResult added in v0.0.16

type GetListOfAllUsersResult struct {
	cmr.CommonResult
	UserIds []cmb.Id `json:"userIds"`
}

type GetListOfLoggedUsersOnPageParams added in v0.0.54

type GetListOfLoggedUsersOnPageParams struct {
	cmr.CommonParams
	Page cmb.Count `json:"page"`
}

type GetListOfLoggedUsersOnPageResult added in v0.0.54

type GetListOfLoggedUsersOnPageResult struct {
	cmr.CommonResult
	LoggedUserIds []cmb.Id      `json:"loggedUserIds"`
	PageData      *cmr.PageData `json:"pageData,omitempty"`
}

type GetListOfLoggedUsersParams

type GetListOfLoggedUsersParams struct {
	cmr.CommonParams
}

type GetListOfLoggedUsersResult

type GetListOfLoggedUsersResult struct {
	cmr.CommonResult
	LoggedUserIds []cmb.Id `json:"loggedUserIds"`
}

type GetListOfRegistrationsReadyForApprovalParams added in v0.0.21

type GetListOfRegistrationsReadyForApprovalParams struct {
	cmr.CommonParams
	Page cmb.Count `json:"page"`
}

type GetListOfRegistrationsReadyForApprovalResult added in v0.0.21

type GetListOfRegistrationsReadyForApprovalResult struct {
	cmr.CommonResult
	RRFA     []RegistrationReadyForApproval `json:"rrfa"`
	PageData *cmr.PageData                  `json:"pageData,omitempty"`
}

type GetSelfRolesParams

type GetSelfRolesParams struct {
	cmr.CommonParams
}

type GetSelfRolesResult

type GetSelfRolesResult struct {
	cmr.CommonResult
	User *User `json:"user"`
}

type GetUserNameParams added in v0.0.38

type GetUserNameParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type GetUserNameResult added in v0.0.38

type GetUserNameResult struct {
	cmr.CommonResult
	User *User `json:"user"`
}

type GetUserRolesParams

type GetUserRolesParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type GetUserRolesResult

type GetUserRolesResult struct {
	cmr.CommonResult
	User *User `json:"user"`
}

type GetUserSessionParams added in v0.0.27

type GetUserSessionParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type GetUserSessionResult added in v0.0.27

type GetUserSessionResult struct {
	cmr.CommonResult
	User    *User    `json:"user"`
	Session *Session `json:"session"`
}

type IsUserLoggedInParams

type IsUserLoggedInParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type IsUserLoggedInResult

type IsUserLoggedInResult struct {
	cmr.CommonResult
	UserId         cmb.Id   `json:"userId"`
	IsUserLoggedIn cmb.Flag `json:"isUserLoggedIn"`
}

type LogEvent

type LogEvent struct {
	Id       cmb.Id
	Time     time.Time
	Type     LogEventType
	UserId   cmb.Id
	Email    cm.Email
	UserIPAB net.IP

	// ID of administrator for those events which were started by an
	// administrator.
	AdminId *cmb.Id
}

type LogEventType

type LogEventType byte

func (LogEventType) IsValid

func (let LogEventType) IsValid() (ok bool)

type LogUserInParams

type LogUserInParams struct {
	cmr.CommonParams

	// Step number.
	StepN cm.StepNumber `json:"stepN"`

	// E-mail address.
	// This is the main identifier of a user.
	// It is used on all steps.
	Email cm.Email `json:"email"`

	// Request ID.
	// It protects preliminary sessions from being hi-jacked.
	// Is used on steps 2 and 3.
	RequestId cm.RequestId `json:"requestId"`

	// Captcha answer.
	// This field is optional and may be used on step 2.
	CaptchaAnswer cm.CaptchaAnswer `json:"captchaAnswer"`

	// Authentication data provided for the challenge.
	// Is used on step 2.
	AuthChallengeResponse cmr.AuthChallengeData `json:"authChallengeResponse"`

	// Verification Code.
	// Is used on step 3.
	VerificationCode cm.VerificationCode `json:"verificationCode"`
}

type LogUserInResult

type LogUserInResult struct {
	cmr.CommonResult

	// Next required step. If set to zero, no further step is required.
	NextStep cm.StepNumber `json:"nextStep"`

	RequestId     cm.RequestId          `json:"requestId"`
	AuthDataBytes cmr.AuthChallengeData `json:"authDataBytes"`

	// Captcha parameters.
	IsCaptchaNeeded cmb.Flag      `json:"isCaptchaNeeded"`
	CaptchaId       *cm.CaptchaId `json:"captchaId"`

	// JWT key maker.
	IsWebTokenSet  cmb.Flag          `json:"isWebTokenSet"`
	WebTokenString cm.WebTokenString `json:"wts,omitempty"`
}

type LogUserOutAParams added in v0.0.24

type LogUserOutAParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type LogUserOutAResult added in v0.0.24

type LogUserOutAResult = cmr.CommonResultWithSuccess

type LogUserOutParams

type LogUserOutParams struct {
	cmr.CommonParams
}

type LogUserOutResult

type LogUserOutResult = cmr.CommonResultWithSuccess

type PasswordChange

type PasswordChange struct {
	Id             cmb.Id
	UserId         cmb.Id
	TimeOfCreation time.Time
	RequestId      *cm.RequestId

	// IP address of a user. B = Byte array.
	UserIPAB net.IP

	AuthDataBytes        cmr.AuthChallengeData
	IsCaptchaRequired    cmb.Flag
	CaptchaId            *cm.CaptchaId
	IsVerifiedByCaptcha  *cmb.Flag
	IsVerifiedByPassword cmb.Flag
	VerificationCode     *cm.VerificationCode
	IsEmailSent          cmb.Flag
	IsVerifiedByEmail    cmb.Flag
	NewPasswordBytes     []byte
}

func NewPasswordChange

func NewPasswordChange() (pc *PasswordChange)

func NewPasswordChangeFromScannableSource

func NewPasswordChangeFromScannableSource(src cm.IScannable) (pc *PasswordChange, err error)

type PasswordChangeVerificationFlags

type PasswordChangeVerificationFlags struct {
	IsVerifiedByCaptcha  *cmb.Flag
	IsVerifiedByPassword cmb.Flag
	IsVerifiedByEmail    cmb.Flag
}

type PingParams

type PingParams = cmr.PingParams

type PingResult

type PingResult = cmr.PingResult

type PreSession

type PreSession struct {
	Id             cmb.Id
	UserId         cmb.Id
	TimeOfCreation time.Time
	RequestId      cm.RequestId

	// IP address of a user. B = Byte array.
	UserIPAB net.IP

	AuthDataBytes        cmr.AuthChallengeData
	IsCaptchaRequired    cmb.Flag
	CaptchaId            *cm.CaptchaId
	IsVerifiedByCaptcha  *cmb.Flag
	IsVerifiedByPassword cmb.Flag

	// Verification code is set on Step 2, so it is NULL on Step 1.
	VerificationCode *cm.VerificationCode

	IsEmailSent       cmb.Flag
	IsVerifiedByEmail cmb.Flag
}

func NewPreSession

func NewPreSession() (ps *PreSession)

func NewPreSessionFromScannableSource

func NewPreSessionFromScannableSource(src cm.IScannable) (ps *PreSession, err error)

type RegisterUserParams

type RegisterUserParams struct {
	cmr.CommonParams

	// Step number.
	StepN cm.StepNumber `json:"stepN"`

	// E-mail address. Is used on steps 1, 2 and 3.
	Email cm.Email `json:"email"`

	// Verification code. Is used on steps 2 and 3.
	VerificationCode cm.VerificationCode `json:"verificationCode"`

	// Name. Is used on step 3.
	Name cm.Name `json:"name"`

	// Password. Is used on step 3.
	Password cm.Password `json:"password"`
}

type RegisterUserResult

type RegisterUserResult struct {
	cmr.CommonResult

	// Next required step. If set to zero, no further step is required.
	NextStep cm.StepNumber `json:"nextStep"`
}

type RegistrationReadyForApproval added in v0.0.21

type RegistrationReadyForApproval struct {
	Id         cmb.Id    `json:"id"`
	PreRegTime time.Time `json:"preRegTime"`
	Email      cm.Email  `json:"email"`
	Name       *cm.Name  `json:"name"`
}

RegistrationReadyForApproval is a short variant of an object representing a request for registration which is ready to be approved.

func NewRegistrationReadyForApproval added in v0.0.21

func NewRegistrationReadyForApproval() (r *RegistrationReadyForApproval)

func NewRegistrationReadyForApprovalFromScannableSource added in v0.0.21

func NewRegistrationReadyForApprovalFromScannableSource(src cm.IScannable) (r *RegistrationReadyForApproval, err error)

type RejectRegistrationRequestParams added in v0.0.22

type RejectRegistrationRequestParams struct {
	cmr.CommonParams
	RegistrationRequestId cmb.Id `json:"registrationRequestId"`
}

type RejectRegistrationRequestResult added in v0.0.22

type RejectRegistrationRequestResult = cmr.CommonResultWithSuccess

type Session

type Session struct {
	Id        cmb.Id    `json:"id"`
	UserId    cmb.Id    `json:"userId"`
	StartTime time.Time `json:"startTime"`

	// IP address of a user. B = Byte array.
	UserIPAB net.IP `json:"userIPA"`
}

func NewSession

func NewSession() (s *Session)

func NewSessionFromScannableSource

func NewSessionFromScannableSource(src cm.IScannable) (s *Session, err error)

type SetUserRoleAuthorParams

type SetUserRoleAuthorParams = SetUserRoleCommonParams

type SetUserRoleAuthorResult

type SetUserRoleAuthorResult = SetUserRoleCommonResult

type SetUserRoleCommonParams added in v0.0.54

type SetUserRoleCommonParams struct {
	cmr.CommonParams
	UserId        cmb.Id   `json:"userId"`
	IsRoleEnabled cmb.Flag `json:"isRoleEnabled"`
}

type SetUserRoleCommonResult added in v0.0.54

type SetUserRoleCommonResult = cmr.CommonResultWithSuccess

type SetUserRoleReaderParams

type SetUserRoleReaderParams = SetUserRoleCommonParams

type SetUserRoleReaderResult

type SetUserRoleReaderResult = SetUserRoleCommonResult

type SetUserRoleWriterParams

type SetUserRoleWriterParams = SetUserRoleCommonParams

type SetUserRoleWriterResult

type SetUserRoleWriterResult = SetUserRoleCommonResult

type ShowDiagnosticDataParams

type ShowDiagnosticDataParams struct{}

type ShowDiagnosticDataResult

type ShowDiagnosticDataResult struct {
	cmr.CommonResult
	cmr.RequestsCount
}

type TestParams

type TestParams struct{}

type TestResult

type TestResult struct {
	cmr.CommonResult
}

type UnbanUserParams

type UnbanUserParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type UnbanUserResult

type UnbanUserResult = cmr.CommonResultWithSuccess

type User

type User struct {
	Password string `json:"-"`
	cm.UserParameters
}

func NewUser

func NewUser() (u *User)

func NewUserFromScannableSource

func NewUserFromScannableSource(src cm.IScannable) (u *User, err error)

type UserData

type UserData struct {
	User    *User
	Session *Session
}

func NewUserData

func NewUserData() (ud *UserData)

type ViewUserParametersParams

type ViewUserParametersParams struct {
	cmr.CommonParams
	UserId cmb.Id `json:"userId"`
}

type ViewUserParametersResult

type ViewUserParametersResult struct {
	cmr.CommonResult
	User *User `json:"user"`
}

Jump to

Keyboard shortcuts

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