util

package
v0.0.0-...-efa0d0c Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFoundMultipleAppUserBlessings = verror.Register("v.io/v23/syncbase/util.FoundMultipleAppUserBlessings", verror.NoRetry, "{1:}{2:} found multiple app:user blessings for different apps or users: {3} and {4}")
	ErrFoundMultipleUserBlessings    = verror.Register("v.io/v23/syncbase/util.FoundMultipleUserBlessings", verror.NoRetry, "{1:}{2:} found multiple user blessings for different users: {3} and {4}")
	ErrFoundNoConventionalBlessings  = verror.Register("v.io/v23/syncbase/util.FoundNoConventionalBlessings", verror.NoRetry, "{1:}{2:} found no blessings matching app:user or user conventions")
)

Functions

func AppAndUserPatternFromBlessings

func AppAndUserPatternFromBlessings(blessings ...string) (app, user security.BlessingPattern, err error)

AppAndUserPatternFromBlessings infers the app and user blessing pattern from the given set of blessing names. <idp>:o:<app>:<user> blessings are preferred, with a fallback to <idp>:u:<user> and unrestricted app. Returns an error and no-match patterns if the inferred pattern is ambiguous (multiple blessings for different apps or users are found), or if no blessings matching conventions are found. TODO(ivanpi): Allow caller to restrict format to app:user or user instead of automatic fallback?

func Decode

func Decode(s string) (string, error)

Decode is the inverse of Encode.

func DecodeId

func DecodeId(s string) (wire.Id, error)

DecodeId is the inverse of EncodeId.

func Encode

func Encode(s string) string

Encode escapes a component name for use in a Syncbase object name. In particular, it replaces bytes "%" and "/" with the "%" character followed by the byte's two-digit hex code. Clients using the client library need not escape names themselves; the client library does so on their behalf.

func EncodeId

func EncodeId(id wire.Id) string

EncodeId encodes the given Id for use in a Syncbase object name.

func FilterTags

func FilterTags(perms access.Permissions, allowTags ...access.Tag) (filtered access.Permissions)

FilterTags returns a copy of the provided perms, filtered to include only entries for tags allowed by the allowTags whitelist.

func IsPrefix

func IsPrefix(start, limit string) bool

IsPrefix returns true if start and limit together represent a prefix range. If true, start is the represented prefix.

func ListChildIds

func ListChildIds(ctx *context.T, parentFullName string) ([]wire.Id, error)

ListChildIds returns a list of ids of all children of parentFullName. Glob is assumed to return the child ids sorted by blessing, then by name.

func NewErrFoundMultipleAppUserBlessings

func NewErrFoundMultipleAppUserBlessings(ctx *context.T, au1 string, au2 string) error

NewErrFoundMultipleAppUserBlessings returns an error with the ErrFoundMultipleAppUserBlessings ID.

func NewErrFoundMultipleUserBlessings

func NewErrFoundMultipleUserBlessings(ctx *context.T, u1 string, u2 string) error

NewErrFoundMultipleUserBlessings returns an error with the ErrFoundMultipleUserBlessings ID.

func NewErrFoundNoConventionalBlessings

func NewErrFoundNoConventionalBlessings(ctx *context.T) error

NewErrFoundNoConventionalBlessings returns an error with the ErrFoundNoConventionalBlessings ID.

func ParseCollectionRowPair

func ParseCollectionRowPair(ctx *context.T, pattern string) (wire.Id, string, error)

ParseCollectionRowPair splits the "<encCxId>/<rowKey>" part of a Syncbase object name into the collection id and the row key or prefix.

func PrefixRangeLimit

func PrefixRangeLimit(p string) string

PrefixRangeLimit returns the limit of the row range for the given prefix.

func PrefixRangeStart

func PrefixRangeStart(p string) string

PrefixRangeStart returns the start of the row range for the given prefix.

func RowPrefixPattern

func RowPrefixPattern(cxId wire.Id, keyPrefix string) wire.CollectionRowPattern

RowPrefixPattern returns a CollectionRowPattern matching a single key prefix in a single collection.

func ValidateId

func ValidateId(id wire.Id) error

ValidateId returns nil iff the given Id is a valid database, collection, or syncgroup Id. TODO(ivanpi): Use verror.New instead of fmt.Errorf everywhere.

func ValidateRowKey

func ValidateRowKey(s string) error

ValidateRowKey returns nil iff the given string is a valid row key.

Types

type AccessController

type AccessController interface {
	// SetPermissions replaces the current Permissions for an object.
	// For detailed documentation, see Object.SetPermissions.
	SetPermissions(ctx *context.T, perms access.Permissions, version string) error

	// GetPermissions returns the current Permissions for an object.
	// For detailed documentation, see Object.GetPermissions.
	GetPermissions(ctx *context.T) (perms access.Permissions, version string, err error)
}

AccessController provides access control for various syncbase objects.

Jump to

Keyboard shortcuts

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