privileges

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Enable = true

Enable enables the new privilege check feature.

View Source
var SkipWithGrant = false

SkipWithGrant causes the server to start without using the privilege system at all.

Functions

This section is empty.

Types

type Handle

type Handle struct {
	// contains filtered or unexported fields
}

Handle wraps MySQLPrivilege providing thread safe access.

func NewHandle

func NewHandle() *Handle

NewHandle returns a Handle.

func (*Handle) Get

func (h *Handle) Get() *MySQLPrivilege

Get the MySQLPrivilege for read.

func (*Handle) Update

func (h *Handle) Update(ctx context.Context) error

Update loads all the privilege info from kv storage.

type MySQLPrivilege

type MySQLPrivilege struct {
	User        []userRecord
	DB          []dbRecord
	TablesPriv  []tablesPrivRecord
	ColumnsPriv []columnsPrivRecord
}

MySQLPrivilege is the in-memory cache of mysql privilege tables.

func (*MySQLPrivilege) DBIsVisible

func (p *MySQLPrivilege) DBIsVisible(user, host, db string) bool

DBIsVisible checks whether the user can see the db.

func (*MySQLPrivilege) LoadAll

func (p *MySQLPrivilege) LoadAll(ctx context.Context) error

LoadAll loads the tables from database to memory.

func (*MySQLPrivilege) LoadColumnsPrivTable

func (p *MySQLPrivilege) LoadColumnsPrivTable(ctx context.Context) error

LoadColumnsPrivTable loads the mysql.columns_priv table from database.

func (*MySQLPrivilege) LoadDBTable

func (p *MySQLPrivilege) LoadDBTable(ctx context.Context) error

LoadDBTable loads the mysql.db table from database.

func (*MySQLPrivilege) LoadTablesPrivTable

func (p *MySQLPrivilege) LoadTablesPrivTable(ctx context.Context) error

LoadTablesPrivTable loads the mysql.tables_priv table from database.

func (*MySQLPrivilege) LoadUserTable

func (p *MySQLPrivilege) LoadUserTable(ctx context.Context) error

LoadUserTable loads the mysql.user table from database.

func (*MySQLPrivilege) RequestVerification

func (p *MySQLPrivilege) RequestVerification(user, host, db, table, column string, priv mysql.PrivilegeType) bool

RequestVerification checks whether the user have sufficient privileges to do the operation.

func (*MySQLPrivilege) UserPrivilegesTable

func (p *MySQLPrivilege) UserPrivilegesTable() [][]types.Datum

UserPrivilegesTable provide data for INFORMATION_SCHEMA.USERS_PRIVILEGE table.

type UserPrivileges

type UserPrivileges struct {
	*Handle
	// contains filtered or unexported fields
}

UserPrivileges implements privilege.Manager interface. This is used to check privilege for the current user.

func (*UserPrivileges) ConnectionVerification

func (p *UserPrivileges) ConnectionVerification(user, host string, authentication, salt []byte) bool

ConnectionVerification implements the Manager interface.

func (*UserPrivileges) DBIsVisible

func (p *UserPrivileges) DBIsVisible(db string) bool

DBIsVisible implements the Manager interface.

func (*UserPrivileges) RequestVerification

func (p *UserPrivileges) RequestVerification(db, table, column string, priv mysql.PrivilegeType) bool

RequestVerification implements the Manager interface.

func (*UserPrivileges) ShowGrants

func (p *UserPrivileges) ShowGrants(ctx context.Context, user *auth.UserIdentity) ([]string, error)

ShowGrants implements privilege.Manager ShowGrants interface.

func (*UserPrivileges) UserPrivilegesTable

func (p *UserPrivileges) UserPrivilegesTable() [][]types.Datum

UserPrivilegesTable implements the Manager interface.

Jump to

Keyboard shortcuts

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