tableacl

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentAclFactory

func GetCurrentAclFactory() (acl.Factory, error)

GetCurrentAclFactory returns current table acl implementation.

func GetCurrentConfig

func GetCurrentConfig() *tableaclpb.Config

GetCurrentConfig returns a copy of current tableacl configuration.

func Init

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

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

InitFromProto inits table ACLs from a proto.

func Register

func Register(name string, factory acl.Factory)

Register registers a AclFactory.

func SetDefaultACL

func SetDefaultACL(name string)

SetDefaultACL sets the default ACL implementation.

Types

type ACLResult

type ACLResult struct {
	acl.ACL
	GroupName string
}

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

func Authorized

func Authorized(table string, role Role) *ACLResult

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

type Role

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
	WRITER
	// ADMIN can run any statements including DDLs
	ADMIN
	// NumRoles is number of Roles defined
	NumRoles
)

func RoleByName

func RoleByName(s string) (Role, bool)

RoleByName returns the Role corresponding to a name

func (Role) Name

func (r Role) Name() string

Name returns the name of a role

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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