constants

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFilePath = "./config.yml"
	CookieName     = "passwall_token"
)
View Source
const (
	EnvPrefix      = "PW"
	EnvDev         = "dev"
	EnvProd        = "prod"
	WorkDirEnv     = "PW_WORK_DIR"
	LogPathEnv     = "PW_LOG_PATH"
	HTTPLogPathEnv = "PW_HTTP_LOG_PATH"
)
View Source
const (
	// DefaultPageSize is the default number of items per page when not specified
	DefaultPageSize = 50

	// MaxPageSize is the maximum allowed number of items per page
	// Set to a high value to allow fetching all user items in one request
	// Since all items are encrypted and belong to the authenticated user,
	// this is safe from a security perspective
	MaxPageSize = 50000
)

Pagination constants These values are used across the application for consistent pagination behavior

View Source
const (
	ContextKeyUserID    = "user_id"
	ContextKeyEmail     = "email"
	ContextKeySchema    = "schema"
	ContextKeyUserRole  = "user_role"
	ContextKeyTokenUUID = "token_uuid"
)

Context keys for storing user information

View Source
const (
	RoleAdmin  = "admin"
	RoleMember = "member"
)

User role names

View Source
const (
	RoleIDAdmin  uint = 1
	RoleIDMember uint = 2
)

User role IDs (must match database)

View Source
const (
	// Users permissions
	PermissionUsersRead   = "users.read"
	PermissionUsersCreate = "users.create"
	PermissionUsersUpdate = "users.update"
	PermissionUsersDelete = "users.delete"

	// Logins permissions
	PermissionLoginsRead   = "logins.read"
	PermissionLoginsCreate = "logins.create"
	PermissionLoginsUpdate = "logins.update"
	PermissionLoginsDelete = "logins.delete"

	// Credit Cards permissions
	PermissionCreditCardsRead   = "credit_cards.read"
	PermissionCreditCardsCreate = "credit_cards.create"
	PermissionCreditCardsUpdate = "credit_cards.update"
	PermissionCreditCardsDelete = "credit_cards.delete"

	// Bank Accounts permissions
	PermissionBankAccountsRead   = "bank_accounts.read"
	PermissionBankAccountsCreate = "bank_accounts.create"
	PermissionBankAccountsUpdate = "bank_accounts.update"
	PermissionBankAccountsDelete = "bank_accounts.delete"

	// Notes permissions
	PermissionNotesRead   = "notes.read"
	PermissionNotesCreate = "notes.create"
	PermissionNotesUpdate = "notes.update"
	PermissionNotesDelete = "notes.delete"

	// Emails permissions
	PermissionEmailsRead   = "emails.read"
	PermissionEmailsCreate = "emails.create"
	PermissionEmailsUpdate = "emails.update"
	PermissionEmailsDelete = "emails.delete"
)

Permission names

Variables

View Source
var DefaultPersonalVaultFolders = []string{"Work", "Personal", "Family", "Social"}

DefaultPersonalVaultFolders are created as organization-level folders when a Personal Vault organization is provisioned.

Functions

func GetRoleID added in v1.28.0

func GetRoleID(roleName string) uint

GetRoleID returns role ID from role name

func GetRoleName added in v1.28.0

func GetRoleName(roleID uint) string

GetRoleName returns role name from role ID

func IsAdmin added in v1.28.0

func IsAdmin(role string) bool

IsAdmin checks if a role is admin

func IsDev added in v1.4.0

func IsDev() bool

func IsValidRole added in v1.28.0

func IsValidRole(role string) bool

IsValidRole checks if a role is valid

Types

This section is empty.

Jump to

Keyboard shortcuts

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