metathings_identityd2_storage

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInitialized  = errors.New("system initialized")
	InvalidArgument = errors.New("invalid argument")
)
View Source
var (
	SYSTEM_CONFIG_INITIALIZE = "init"
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	Name        *string `gorm:"column:name"`
	Alias       *string `gorm:"column:alias"`
	Description *string `gorm:"column:description"`
	Extra       *string `gorm:"column:extra"`
}

type ActionRoleMapping

type ActionRoleMapping struct {
	CreatedAt time.Time

	ActionId *string `gorm:"action_id"`
	RoleId   *string `gorm:"role_id"`
}

type Credential

type Credential struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	DomainId    *string    `gorm:"column:domain_id"`
	EntityId    *string    `gorm:"column:entity_id"`
	Name        *string    `gorm:"column:name"`
	Alias       *string    `gorm:"column:alias"`
	Secret      *string    `gorm:"column:secret"`
	Description *string    `gorm:"column:description"`
	ExpiresAt   *time.Time `gorm:"column:expires_at"`

	Domain *Domain `gorm:"-"`
	Entity *Entity `gorm:"-"`
	Roles  []*Role `gorm:"-"`
}

type CredentialRoleMapping

type CredentialRoleMapping struct {
	CreatedAt time.Time

	CredentialId *string `gorm:"credential_id"`
	RoleId       *string `gorm:"role_id"`
}

type Domain

type Domain struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	Name     *string `gorm:"column:name"`
	Alias    *string `gorm:"column:alias"`
	ParentId *string `gorm:"column:parent_id"`
	Extra    *string `gorm:"extra"`

	Parent   *Domain   `gorm:"-"`
	Children []*Domain `gorm:"-"`
}

type Entity

type Entity struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	Name     *string `gorm:"column:name"`
	Alias    *string `gorm:"column:alias"`
	Password *string `gorm:"column:password"`
	Extra    *string `gorm:"column:extra"`

	Domains []*Domain `gorm:"-"`
	Groups  []*Group  `gorm:"-"`
	Roles   []*Role   `gorm:"-"`
}

type EntityDomainMapping

type EntityDomainMapping struct {
	CreatedAt time.Time

	EntityId *string `gorm:"entity_id"`
	DomainId *string `gorm:"domain_id"`
}

type EntityRoleMapping

type EntityRoleMapping struct {
	CreatedAt time.Time

	EntityId *string `gorm:"entity_id"`
	RoleId   *string `gorm:"role_id"`
}

type Group

type Group struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	DomainId    *string `gorm:"column:domain_id"`
	Name        *string `gorm:"column:name"`
	Alias       *string `gorm:"column:alias"`
	Description *string `gorm:"column:description"`
	Extra       *string `gorm:"column:extra"`

	Domain   *Domain   `gorm:"-"`
	Subjects []*Entity `gorm:"-"`
	Objects  []*Entity `gorm:"-"`
	Roles    []*Role   `gorm:"-"`
}

type GroupRoleMapping

type GroupRoleMapping struct {
	CreatedAt time.Time

	GroupId *string `gorm:"group_id"`
	RoleId  *string `gorm:"role_id"`
}

type ObjectGroupMapping

type ObjectGroupMapping struct {
	CreatedAt time.Time

	ObjectId *string `gorm:"object_id"`
	GroupId  *string `gorm:"group_id"`
}

type Role

type Role struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	Name        *string `gorm:"column:name"`
	Alias       *string `gorm:"column:alias"`
	Description *string `gorm:"column:description"`
	Extra       *string `gorm:"column:extra"`

	Actions []*Action `gorm:"-"`
}

type Storage

type Storage interface {
	IsInitialized() (bool, error)
	Initialize() error

	CreateDomain(*Domain) (*Domain, error)
	DeleteDomain(id string) error
	PatchDomain(id string, domain *Domain) (*Domain, error)
	GetDomain(id string) (*Domain, error)
	ListDomains(*Domain) ([]*Domain, error)
	AddEntityToDomain(domain_id, entity_id string) error
	RemoveEntityFromDomain(domain_id, entity_id string) error

	CreateAction(*Action) (*Action, error)
	DeleteAction(id string) error
	PatchAction(id string, action *Action) (*Action, error)
	GetAction(id string) (*Action, error)
	ListActions(*Action) ([]*Action, error)

	CreateRole(*Role) (*Role, error)
	DeleteRole(id string) error
	PatchRole(id string, role *Role) (*Role, error)
	GetRole(id string) (*Role, error)
	GetRoleWithFullActions(id string) (*Role, error)
	ListRoles(*Role) ([]*Role, error)
	AddActionToRole(role_id, action_id string) error
	RemoveActionFromRole(role_id, action_id string) error

	CreateEntity(*Entity) (*Entity, error)
	DeleteEntity(id string) error
	PatchEntity(id string, entity *Entity) (*Entity, error)
	GetEntity(id string) (*Entity, error)
	GetEntityByName(name string) (*Entity, error)
	ListEntities(*Entity) ([]*Entity, error)
	ListEntitiesByDomainId(dom_id string) ([]*Entity, error)
	AddRoleToEntity(entity_id, role_id string) error
	RemoveRoleFromEntity(entity_id, role_id string) error

	CreateGroup(*Group) (*Group, error)
	DeleteGroup(id string) error
	PatchGroup(id string, group *Group) (*Group, error)
	GetGroup(id string) (*Group, error)
	ExistGroup(id string) (bool, error)
	ListGroups(*Group) ([]*Group, error)
	AddRoleToGroup(group_id, role_id string) error
	RemoveRoleFromGroup(group_id, role_id string) error
	AddSubjectToGroup(group_id, subject_id string) error
	RemoveSubjectFromGroup(group_id, subject_id string) error
	SubjectExistsInGroup(subject_id, group_id string) (bool, error)
	AddObjectToGroup(group_id, object_id string) error
	RemoveObjectFromGroup(group_id, object_id string) error
	ObjectExistsInGroup(object_id, group_id string) (bool, error)
	ListGroupsForSubject(subject_id string) ([]*Group, error)
	ListGroupsForObject(subject_id string) ([]*Group, error)

	CreateCredential(*Credential) (*Credential, error)
	DeleteCredential(id string) error
	PatchCredential(id string, credential *Credential) (*Credential, error)
	GetCredential(id string) (*Credential, error)
	ListCredentials(*Credential) ([]*Credential, error)

	CreateToken(*Token) (*Token, error)
	DeleteToken(id string) error
	RefreshToken(id string, expires_at time.Time) error
	GetTokenByText(text string) (*Token, error)
	GetToken(id string) (*Token, error)
	ListTokens(*Token) ([]*Token, error)
}

func NewStorage

func NewStorage(driver, uri string, args ...interface{}) (Storage, error)

type StorageImpl

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

func NewStorageImpl

func NewStorageImpl(driver, uri string, args ...interface{}) (*StorageImpl, error)

func (*StorageImpl) AddActionToRole

func (self *StorageImpl) AddActionToRole(role_id, action_id string) error

func (*StorageImpl) AddEntityToDomain

func (self *StorageImpl) AddEntityToDomain(domain_id, entity_id string) error

func (*StorageImpl) AddObjectToGroup

func (self *StorageImpl) AddObjectToGroup(group_id, object_id string) error

func (*StorageImpl) AddRoleToEntity

func (self *StorageImpl) AddRoleToEntity(entity_id, role_id string) error

func (*StorageImpl) AddRoleToGroup

func (self *StorageImpl) AddRoleToGroup(group_id, role_id string) error

func (*StorageImpl) AddSubjectToGroup

func (self *StorageImpl) AddSubjectToGroup(group_id, subject_id string) error

func (*StorageImpl) CreateAction

func (self *StorageImpl) CreateAction(act *Action) (*Action, error)

func (*StorageImpl) CreateCredential

func (self *StorageImpl) CreateCredential(cred *Credential) (*Credential, error)

func (*StorageImpl) CreateDomain

func (self *StorageImpl) CreateDomain(dom *Domain) (*Domain, error)

func (*StorageImpl) CreateEntity

func (self *StorageImpl) CreateEntity(ent *Entity) (*Entity, error)

func (*StorageImpl) CreateGroup

func (self *StorageImpl) CreateGroup(grp *Group) (*Group, error)

func (*StorageImpl) CreateRole

func (self *StorageImpl) CreateRole(role *Role) (*Role, error)

func (*StorageImpl) CreateToken

func (self *StorageImpl) CreateToken(tkn *Token) (*Token, error)

func (*StorageImpl) DeleteAction

func (self *StorageImpl) DeleteAction(id string) error

func (*StorageImpl) DeleteCredential

func (self *StorageImpl) DeleteCredential(id string) error

func (*StorageImpl) DeleteDomain

func (self *StorageImpl) DeleteDomain(id string) error

func (*StorageImpl) DeleteEntity

func (self *StorageImpl) DeleteEntity(id string) error

func (*StorageImpl) DeleteGroup

func (self *StorageImpl) DeleteGroup(id string) error

func (*StorageImpl) DeleteRole

func (self *StorageImpl) DeleteRole(id string) error

func (*StorageImpl) DeleteToken

func (self *StorageImpl) DeleteToken(id string) error

func (*StorageImpl) ExistGroup

func (self *StorageImpl) ExistGroup(id string) (bool, error)

func (*StorageImpl) GetAction

func (self *StorageImpl) GetAction(id string) (*Action, error)

func (*StorageImpl) GetCredential

func (self *StorageImpl) GetCredential(id string) (*Credential, error)

func (*StorageImpl) GetDomain

func (self *StorageImpl) GetDomain(id string) (*Domain, error)

func (*StorageImpl) GetEntity

func (self *StorageImpl) GetEntity(id string) (*Entity, error)

todo remove password from return. zh

func (*StorageImpl) GetEntityByName

func (self *StorageImpl) GetEntityByName(name string) (*Entity, error)

func (*StorageImpl) GetGroup

func (self *StorageImpl) GetGroup(id string) (*Group, error)

func (*StorageImpl) GetRole

func (self *StorageImpl) GetRole(id string) (*Role, error)

func (*StorageImpl) GetRoleWithFullActions

func (self *StorageImpl) GetRoleWithFullActions(id string) (*Role, error)

func (*StorageImpl) GetToken

func (self *StorageImpl) GetToken(id string) (*Token, error)

func (*StorageImpl) GetTokenByText

func (self *StorageImpl) GetTokenByText(text string) (*Token, error)

func (*StorageImpl) Initialize

func (self *StorageImpl) Initialize() error

func (*StorageImpl) IsInitialized

func (self *StorageImpl) IsInitialized() (bool, error)

func (*StorageImpl) ListActions

func (self *StorageImpl) ListActions(act *Action) ([]*Action, error)

func (*StorageImpl) ListCredentials

func (self *StorageImpl) ListCredentials(cred *Credential) ([]*Credential, error)

func (*StorageImpl) ListDomains

func (self *StorageImpl) ListDomains(dom *Domain) ([]*Domain, error)

func (*StorageImpl) ListEntities

func (self *StorageImpl) ListEntities(ent *Entity) ([]*Entity, error)

func (*StorageImpl) ListEntitiesByDomainId

func (self *StorageImpl) ListEntitiesByDomainId(id string) ([]*Entity, error)

func (*StorageImpl) ListGroups

func (self *StorageImpl) ListGroups(grp *Group) ([]*Group, error)

func (*StorageImpl) ListGroupsForObject

func (self *StorageImpl) ListGroupsForObject(object_id string) ([]*Group, error)

func (*StorageImpl) ListGroupsForSubject

func (self *StorageImpl) ListGroupsForSubject(subject_id string) ([]*Group, error)

func (*StorageImpl) ListRoles

func (self *StorageImpl) ListRoles(role *Role) ([]*Role, error)

func (*StorageImpl) ListTokens

func (self *StorageImpl) ListTokens(tkn *Token) ([]*Token, error)

func (*StorageImpl) ObjectExistsInGroup

func (self *StorageImpl) ObjectExistsInGroup(object_id, group_id string) (bool, error)

func (*StorageImpl) PatchAction

func (self *StorageImpl) PatchAction(id string, action *Action) (*Action, error)

func (*StorageImpl) PatchCredential

func (self *StorageImpl) PatchCredential(id string, credential *Credential) (*Credential, error)

func (*StorageImpl) PatchDomain

func (self *StorageImpl) PatchDomain(id string, domain *Domain) (*Domain, error)

func (*StorageImpl) PatchEntity

func (self *StorageImpl) PatchEntity(id string, entity *Entity) (*Entity, error)

func (*StorageImpl) PatchGroup

func (self *StorageImpl) PatchGroup(id string, group *Group) (*Group, error)

func (*StorageImpl) PatchRole

func (self *StorageImpl) PatchRole(id string, role *Role) (*Role, error)

func (*StorageImpl) RefreshToken

func (self *StorageImpl) RefreshToken(id string, expires_at time.Time) error

func (*StorageImpl) RemoveActionFromRole

func (self *StorageImpl) RemoveActionFromRole(role_id, action_id string) error

func (*StorageImpl) RemoveEntityFromDomain

func (self *StorageImpl) RemoveEntityFromDomain(domain_id, entity_id string) error

func (*StorageImpl) RemoveObjectFromGroup

func (self *StorageImpl) RemoveObjectFromGroup(group_id, object_id string) error

func (*StorageImpl) RemoveRoleFromEntity

func (self *StorageImpl) RemoveRoleFromEntity(entity_id, role_id string) error

func (*StorageImpl) RemoveRoleFromGroup

func (self *StorageImpl) RemoveRoleFromGroup(group_id, role_id string) error

func (*StorageImpl) RemoveSubjectFromGroup

func (self *StorageImpl) RemoveSubjectFromGroup(group_id, subject_id string) error

func (*StorageImpl) SubjectExistsInGroup

func (self *StorageImpl) SubjectExistsInGroup(subject_id, group_id string) (bool, error)

type SubjectGroupMapping

type SubjectGroupMapping struct {
	CreatedAt time.Time

	SubjectId *string `gorm:"subject_id"`
	GroupId   *string `gorm:"group_id"`
}

type SystemConfig

type SystemConfig struct {
	CreatedAt time.Time
	UpdatedAt time.Time

	Key   *string `gorm:"column:key"`
	Value *string `gorm:"column:value"`
}

type Token

type Token struct {
	Id        *string
	CreatedAt time.Time
	UpdatedAt time.Time

	DomainId     *string    `gorm:"column:domain_id"`
	EntityId     *string    `gorm:"column:entity_id"`
	CredentialId *string    `gorm:"column:credential_id"`
	IssuedAt     *time.Time `gorm:"column:issued_at"`
	ExpiresAt    *time.Time `gorm:"column:expires_at"`
	Text         *string    `gorm:"column:text"`

	Domain     *Domain     `gorm:"-"`
	Entity     *Entity     `gorm:"-"`
	Credential *Credential `gorm:"-"`
	Roles      []*Role     `gorm:"-"`
	Groups     []*Group    `gorm:"-"`
}

Jump to

Keyboard shortcuts

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