Documentation ¶
Index ¶
- Variables
- type Handle
- type MySQLPrivilege
- func (p *MySQLPrivilege) DBIsVisible(user, host, db string) bool
- func (p *MySQLPrivilege) LoadAll(ctx context.Context) error
- func (p *MySQLPrivilege) LoadColumnsPrivTable(ctx context.Context) error
- func (p *MySQLPrivilege) LoadDBTable(ctx context.Context) error
- func (p *MySQLPrivilege) LoadTablesPrivTable(ctx context.Context) error
- func (p *MySQLPrivilege) LoadUserTable(ctx context.Context) error
- func (p *MySQLPrivilege) RequestVerification(user, host, db, table, column string, priv mysql.PrivilegeType) bool
- func (p *MySQLPrivilege) UserPrivilegesTable() [][]types.Datum
- type UserPrivileges
- func (p *UserPrivileges) ConnectionVerification(user, host string, authentication, salt []byte) bool
- func (p *UserPrivileges) DBIsVisible(db string) bool
- func (p *UserPrivileges) RequestVerification(db, table, column string, priv mysql.PrivilegeType) bool
- func (p *UserPrivileges) ShowGrants(ctx context.Context, user *auth.UserIdentity) ([]string, error)
- func (p *UserPrivileges) UserPrivilegesTable() [][]types.Datum
Constants ¶
This section is empty.
Variables ¶
var Enable = true
Enable enables the new privilege check feature.
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.
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.