go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/tableacl Index | Files | Directories

package tableacl

import "gopkg.in/src-d/go-vitess.v1/vt/tableacl"


Package Files

role.go tableacl.go

func GetCurrentACLFactory Uses

func GetCurrentACLFactory() (acl.Factory, error)

GetCurrentACLFactory returns current table acl implementation.

func GetCurrentConfig Uses

func GetCurrentConfig() *tableaclpb.Config

GetCurrentConfig returns a copy of current tableacl configuration.

func Init Uses

func Init(configFile string, aclCB func()) error

Init initiates table ACLs.

The config file can be binary-proto-encoded, or json-encoded. In the json case, it looks like this:


"table_groups": [
    "table_names_or_prefixes": ["name1"],
    "readers": ["client1"],
    "writers": ["client1"],
    "admins": ["client1"]


func InitFromProto Uses

func InitFromProto(config *tableaclpb.Config) error

InitFromProto inits table ACLs from a proto.

func Register Uses

func Register(name string, factory acl.Factory)

Register registers an AclFactory.

func SetDefaultACL Uses

func SetDefaultACL(name string)

SetDefaultACL sets the default ACL implementation.

func ValidateProto Uses

func ValidateProto(config *tableaclpb.Config) (err error)

ValidateProto returns an error if the given proto has problems that would cause InitFromProto to fail.

type ACLResult Uses

type ACLResult struct {
    GroupName string

ACLResult embeds an acl.ACL and also tell which table group it belongs to.

func Authorized Uses

func Authorized(table string, role Role) *ACLResult

Authorized returns the list of entities who have the specified role on a tablel.

type Role Uses

type Role int

Role defines the level of access on a table

const (
    // READER can run SELECT statements
    READER Role = iota
    // WRITER can run SELECT, INSERT & UPDATE statements
    // ADMIN can run any statements including DDLs
    // NumRoles is number of Roles defined

func RoleByName Uses

func RoleByName(s string) (Role, bool)

RoleByName returns the Role corresponding to a name

func (Role) Name Uses

func (r Role) Name() string

Name returns the name of a role



Package tableacl imports 16 packages (graph) and is imported by 6 packages. Updated 2019-06-13. Refresh now. Tools for package owners.