privilege

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepository

func NewRepository(db middleware.Pool) privilege.Repository

NewRepository returns privilege.Repository with given middleware.Pool

func NewRepositoryWithGlobal

func NewRepositoryWithGlobal() privilege.Repository

NewRepositoryWithGlobal returns privilege.Repository with global mysql pool

func NewService

func NewService(repo privilege.Repository, token, loginName string) privilege.Service

NewService returns privilege.Service with given user

func NewServiceWithDefault

func NewServiceWithDefault(token, loginName string) privilege.Service

NewServiceWithDefault returns privilege.Service with default value

Types

type Repository

type Repository struct {
	Database middleware.Pool
}

func (*Repository) Execute

func (r *Repository) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware

func (*Repository) GetMySQLClusterIDByDBID

func (r *Repository) GetMySQLClusterIDByDBID(dbID int) (int, error)

GetMySQLClusterIDByDBID gets mysql cluster id by db id

func (*Repository) GetMySQLClusterIDByHostInfo

func (r *Repository) GetMySQLClusterIDByHostInfo(hostIP string, portNum int) (int, error)

GetMySQLClusterIDByHostInfo gets mysql cluster id by mysql server host ip and port number

func (*Repository) GetMySQLClusterIDByMySQLServerID

func (r *Repository) GetMySQLClusterIDByMySQLServerID(mysqlServerID int) (int, error)

GetMySQLClusterIDByMySQLServerID gets mysql cluster id by mysql server id

func (*Repository) GetMySQLClusterIDListByLoginName

func (r *Repository) GetMySQLClusterIDListByLoginName(loginName string) ([]int, error)

GetMySQLClusterIDListByLoginName gets mysql cluster id list by login name

func (*Repository) GetUserRoleByLoginName

func (r *Repository) GetUserRoleByLoginName(loginName string) (int, error)

GetUserRoleByLoginName get user role by login name

type Service

type Service struct {
	privilege.Repository
	// contains filtered or unexported fields
}

func (*Service) CheckDBByID

func (s *Service) CheckDBByID(dbID int) error

CheckDBByID checks if given user has privilege to the database with db id

func (*Service) CheckMySQLClusterByID

func (s *Service) CheckMySQLClusterByID(mysqlClusterID int) error

CheckMySQLClusterByID checks if given user has privilege to the mysql cluster with mysql cluster id

func (*Service) CheckMySQLServerByHostInfo

func (s *Service) CheckMySQLServerByHostInfo(hostIP string, portNum int) error

CheckMySQLServerByHostInfo checks if given user has privilege to the mysql server with host ip and port number

func (*Service) CheckMySQLServerByID

func (s *Service) CheckMySQLServerByID(mysqlServerID int) error

CheckMySQLServerByID checks if given user has privilege to the mysql server with mysql server id

func (*Service) GetLoginName

func (s *Service) GetLoginName() string

GetLoginName returns the login name

func (*Service) GetToken

func (s *Service) GetToken() string

GetToken returns the token

Jump to

Keyboard shortcuts

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