Users

The Users feature provides core user management functionality in the Voedger system. It handles user registration, profile management, and password operations.


Architecture

Principles

  • 🏡 Login table keeps hashes of logins to avoid potential personal data compliance issues

Core tables

sys.UserProfileWS.UserProfile

ALTERABLE WORKSPACE UserProfileWS INHERITS sys.ProfileWS (
	DESCRIPTOR UserProfile (
		DisplayName varchar,
	);
    ...

registry.AppWorkspaceWS.Login

ALTER WORKSPACE sys.AppWorkspaceWS (
	TABLE Login INHERITS sys.CDoc (
		ProfileCluster int32 NOT NULL,
		PwdHash bytes NOT NULL,
		AppName varchar NOT NULL,
		SubjectKind int32,
		LoginHash varchar NOT NULL,
		WSID int64,                                     -- to be written after workspace init
		WSError varchar(1024),                          -- to be written after workspace init
		WSKindInitializationData varchar(1024) NOT NULL
	);

cdoc.sys.Workspace.Invite

	TABLE Invite INHERITS sys.CDoc (
		SubjectKind int32,
		Login varchar NOT NULL,
		Email varchar NOT NULL,
		Roles varchar(1024),
		ExpireDatetime int64,
		VerificationCode varchar,
		State int32 NOT NULL,
		Created int64,
		Updated int64 NOT NULL,
		SubjectID ref,
		InviteeProfileWSID int64,
		ActualLogin varchar,
		UNIQUEFIELD Email
	) WITH Tags=(WorkspaceOwnerTableTag);

cdoc.sys.Workspace.Subject

	TABLE Subject INHERITS sys.CDoc (
		Login varchar NOT NULL, <--
		SubjectKind int32 NOT NULL,
		Roles varchar(1024) NOT NULL,
		ProfileWSID int64 NOT NULL,
		UNIQUEFIELD Login
	) WITH Tags=(WorkspaceOwnerTableTag);

	VIEW ViewSubjectsIdx (
		LoginHash int64 NOT NULL,
		Login text NOT NULL,
		SubjectID ref NOT NULL,
		PRIMARY KEY ((LoginHash), Login)
	) AS RESULT OF ApplyViewSubjectsIdx WITH Tags=(WorkspaceOwnerTableTag);

Background

Email Sending:

SMTP Configuration:

  • The smtp package defines the SMTP configuration in types.go: types.go.

  • Functions related to SMTP configuration are in impl.go: impl.go.

Email Verification Tokens:

  • The userprofile.vsql file includes commands for sending email verification codes: userprofile.vsql.

The implementation of Storage_SendMail:

  • Can be found in the pkg/sys/storages/impl_send_mail_storage.go file. You can view the implementation.

Last updated

Was this helpful?