migrate

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

nolint: staticcheck

nolint: staticcheck

nolint: staticcheck

Index

Constants

View Source
const Obsolete int32 = 16

Variables

View Source
var RefObjectTypes = map[string]*dsc2.ObjectType{
	"system":      {Name: "system", DisplayName: "System", IsSubject: false, Ordinal: 6, Status: uint32(dsc2.Flag_FLAG_HIDDEN | dsc2.Flag_FLAG_SYSTEM | dsc2.Flag(Obsolete))},
	"user":        {Name: "user", DisplayName: "User", IsSubject: true, Ordinal: 1, Status: uint32(dsc2.Flag_FLAG_SYSTEM)},
	"identity":    {Name: "identity", DisplayName: "Identity", IsSubject: false, Ordinal: 2, Status: uint32(dsc2.Flag_FLAG_SYSTEM | dsc2.Flag_FLAG_READONLY)},
	"group":       {Name: "group", DisplayName: "Group", IsSubject: true, Ordinal: 3, Status: uint32(dsc2.Flag_FLAG_SYSTEM)},
	"application": {Name: "application", DisplayName: "Application", IsSubject: false, Ordinal: 4, Status: uint32(dsc2.Flag_FLAG_SYSTEM | dsc2.Flag(Obsolete))},
	"resource":    {Name: "resource", DisplayName: "Resource", IsSubject: false, Ordinal: 5, Status: uint32(dsc2.Flag_FLAG_SYSTEM | dsc2.Flag(Obsolete))},
	"user-v1":     {Name: "user-v1", DisplayName: "UserV1", IsSubject: true, Ordinal: 0, Status: uint32(dsc2.Flag_FLAG_HIDDEN | dsc2.Flag_FLAG_SYSTEM | dsc2.Flag_FLAG_SHADOW | dsc2.Flag_FLAG_READONLY | dsc2.Flag(Obsolete))},
}
View Source
var RefRelationTypes = map[string]map[string]*dsc2.RelationType{
	"system":      {"user": {ObjectType: "system", Name: "user", DisplayName: "system#user", Ordinal: 0, Status: uint32(dsc2.Flag_FLAG_SYSTEM | dsc2.Flag(Obsolete))}},
	"identity":    {"identifier": {ObjectType: "identity", Name: "identifier", Unions: []string{"user"}, DisplayName: "identity#identifier", Ordinal: 0, Status: uint32(dsc2.Flag_FLAG_SYSTEM)}},
	"group":       {"member": {ObjectType: "group", Name: "member", Unions: []string{"user"}, DisplayName: "group#member", Ordinal: 0, Status: uint32(dsc2.Flag_FLAG_SYSTEM)}},
	"application": {"user": {ObjectType: "application", Name: "user", DisplayName: "application#user", Ordinal: 0, Status: uint32(dsc2.Flag_FLAG_SYSTEM | dsc2.Flag(Obsolete))}},
	"user":        {"manager": {ObjectType: "user", Name: "manager", Unions: []string{"user"}, DisplayName: "user#manager", Ordinal: 0, Status: uint32(dsc2.Flag_FLAG_SYSTEM)}},
}

Functions

func IsObsolete

func IsObsolete(status dsc2.Flag) bool

func WriteManifest

func WriteManifest(w io.Writer, md *Metadata, pts *ObjPermRelContainer)

Types

type Metadata

type Metadata struct {
	ObjectTypes   []*dsc2.ObjectType
	RelationTypes []*dsc2.RelationType
	Permissions   []*dsc2.Permission
}

type Migrator

type Migrator struct {
	Metadata      *Metadata
	RelationMap   *ObjRelSubContainer
	PermissionMap *ObjPermRelContainer
}

func NewMigrator

func NewMigrator() *Migrator

func (*Migrator) Load added in v0.0.6

func (m *Migrator) Load(conn grpc.ClientConnInterface) error

Load hydrates the migrator from given gRPC connection.

func (*Migrator) Process

func (m *Migrator) Process() error

func (*Migrator) Write

func (m *Migrator) Write(w io.Writer, opts ...WriterOption) error

type ObjPermRel

type ObjPermRel struct {
	Object     string
	Permission string
	Relation   string
}

type ObjPermRelContainer

type ObjPermRelContainer struct {
	// contains filtered or unexported fields
}

func NewObjPermRelContainer

func NewObjPermRelContainer() *ObjPermRelContainer

func (*ObjPermRelContainer) Add

func (o *ObjPermRelContainer) Add(opr *ObjPermRel)

func (*ObjPermRelContainer) All

func (o *ObjPermRelContainer) All() []*ObjPermRel

func (*ObjPermRelContainer) GetPerms

func (o *ObjPermRelContainer) GetPerms(obj string) map[string]map[string]struct{}

type ObjRelSub

type ObjRelSub struct {
	Object   string
	Relation string
	Subject  string
}

type ObjRelSubContainer

type ObjRelSubContainer struct {
	// contains filtered or unexported fields
}

func NewObjRelSubContainer

func NewObjRelSubContainer() *ObjRelSubContainer

func (*ObjRelSubContainer) Add

func (o *ObjRelSubContainer) Add(ors *ObjRelSub)

func (*ObjRelSubContainer) All

func (o *ObjRelSubContainer) All() []*ObjRelSub

func (*ObjRelSubContainer) Get

func (o *ObjRelSubContainer) Get(obj, rel, sub string) (*ObjRelSub, bool)

func (*ObjRelSubContainer) GetRels

func (o *ObjRelSubContainer) GetRels(obj string) []*ObjRelSub

func (*ObjRelSubContainer) GetSubs

func (o *ObjRelSubContainer) GetSubs(obj, rel string) []*ObjRelSub

func (*ObjRelSubContainer) RelationCount

func (o *ObjRelSubContainer) RelationCount() int

type WriterArgs added in v0.0.11

type WriterArgs struct {
	// contains filtered or unexported fields
}

type WriterOption added in v0.0.11

type WriterOption func(*WriterArgs)

func WithDescription added in v0.0.11

func WithDescription(description string) WriterOption

Description label.

func WithFilename added in v0.0.11

func WithFilename(filename string) WriterOption

Filename label.

func WithHeader added in v0.0.11

func WithHeader(header bool) WriterOption

Include schema header.

func WithTimestamp added in v0.0.11

func WithTimestamp(timestamp bool) WriterOption

Include timestamp.

Jump to

Keyboard shortcuts

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