postgres

package
v3.83.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	PermissionStrings = map[Permission]string{
		BypassRls:          "bypass_rls",
		Connect:            "connect",
		Create:             "create",
		CreateDb:           "create_db",
		CreateRole:         "create_role",
		Delete:             "delete",
		InheritanceOfPrivs: "inheritance_of_privs",
		Insert:             "insert",
		Login:              "login",
		References:         "references",
		Replication:        "replication",
		Select:             "select",
		Superuser:          "superuser",
		Temp:               "temp",
		Trigger:            "trigger",
		Truncate:           "truncate",
		Update:             "update",
	}

	StringToPermission = map[string]Permission{
		"bypass_rls":           BypassRls,
		"connect":              Connect,
		"create":               Create,
		"create_db":            CreateDb,
		"create_role":          CreateRole,
		"delete":               Delete,
		"inheritance_of_privs": InheritanceOfPrivs,
		"insert":               Insert,
		"login":                Login,
		"references":           References,
		"replication":          Replication,
		"select":               Select,
		"superuser":            Superuser,
		"temp":                 Temp,
		"trigger":              Trigger,
		"truncate":             Truncate,
		"update":               Update,
	}

	PermissionIDs = map[Permission]int{
		BypassRls:          1,
		Connect:            2,
		Create:             3,
		CreateDb:           4,
		CreateRole:         5,
		Delete:             6,
		InheritanceOfPrivs: 7,
		Insert:             8,
		Login:              9,
		References:         10,
		Replication:        11,
		Select:             12,
		Superuser:          13,
		Temp:               14,
		Trigger:            15,
		Truncate:           16,
		Update:             17,
	}

	IdToPermission = map[int]Permission{
		1:  BypassRls,
		2:  Connect,
		3:  Create,
		4:  CreateDb,
		5:  CreateRole,
		6:  Delete,
		7:  InheritanceOfPrivs,
		8:  Insert,
		9:  Login,
		10: References,
		11: Replication,
		12: Select,
		13: Superuser,
		14: Temp,
		15: Trigger,
		16: Truncate,
		17: Update,
	}
)

Functions

func AnalyzeAndPrintPermissions added in v3.80.5

func AnalyzeAndPrintPermissions(cfg *config.Config, connectionStr string)

Types

type Analyzer added in v3.82.0

type Analyzer struct {
	Cfg *config.Config
}

func (Analyzer) Analyze added in v3.82.0

func (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error)

func (Analyzer) Type added in v3.82.0

type DB

type DB struct {
	DatabaseName string
	Owner        string
	DBPrivs
}

type DBPrivs

type DBPrivs struct {
	Connect    bool
	Create     bool
	CreateTemp bool
}

type Permission added in v3.82.0

type Permission int
const (
	Invalid            Permission = iota
	BypassRls          Permission = iota
	Connect            Permission = iota
	Create             Permission = iota
	CreateDb           Permission = iota
	CreateRole         Permission = iota
	Delete             Permission = iota
	InheritanceOfPrivs Permission = iota
	Insert             Permission = iota
	Login              Permission = iota
	References         Permission = iota
	Replication        Permission = iota
	Select             Permission = iota
	Superuser          Permission = iota
	Temp               Permission = iota
	Trigger            Permission = iota
	Truncate           Permission = iota
	Update             Permission = iota
)

func PermissionFromID added in v3.82.0

func PermissionFromID(id int) (Permission, error)

PermissionFromID converts an ID to its Permission enum

func PermissionFromString added in v3.82.0

func PermissionFromString(s string) (Permission, error)

PermissionFromString converts a string representation to its Permission enum

func (Permission) ToID added in v3.82.0

func (p Permission) ToID() (int, error)

ToID converts a Permission enum to its ID

func (Permission) ToString added in v3.82.0

func (p Permission) ToString() (string, error)

ToString converts a Permission enum to its string representation

type SecretInfo added in v3.80.5

type SecretInfo struct {
	Host       string
	User       string
	Role       string
	RolePrivs  map[string]bool
	DBs        []DB
	TablePrivs map[string]map[string]*TableData
}

func AnalyzePermissions

func AnalyzePermissions(cfg *config.Config, connectionStr string) (*SecretInfo, error)

type TableData

type TableData struct {
	Size  string
	Rows  string
	Privs TablePrivs
}

type TablePrivs

type TablePrivs struct {
	Select     bool
	Insert     bool
	Update     bool
	Delete     bool
	Truncate   bool
	References bool
	Trigger    bool
}

Jump to

Keyboard shortcuts

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