migrate

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

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) 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

Jump to

Keyboard shortcuts

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