space

package
v0.0.0-...-284eadf Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package space provides all the required functions to manage the definition of spaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormResourceRepository

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

GormResourceRepository implements ResourceRepository using gorm

func NewResourceRepository

func NewResourceRepository(db *gorm.DB) *GormResourceRepository

NewResourceRepository creates a new space resource repo

func (*GormResourceRepository) CheckExists

func (m *GormResourceRepository) CheckExists(ctx context.Context, id string) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormResourceRepository) Create

func (r *GormResourceRepository) Create(ctx context.Context, resource *Resource) (*Resource, error)

Create creates a new Space Resource in the DB returns InternalError

func (*GormResourceRepository) Delete

func (r *GormResourceRepository) Delete(ctx context.Context, ID uuid.UUID) error

Delete deletes the space resource with the given id returns NotFoundError or InternalError

func (*GormResourceRepository) Load

Load returns the space resource for the given id returns NotFoundError or InternalError

func (*GormResourceRepository) LoadBySpace

func (r *GormResourceRepository) LoadBySpace(ctx context.Context, spaceID *uuid.UUID) (*Resource, error)

LoadBySpace loads space resource by space ID

func (*GormResourceRepository) Save

Save updates the given space resource in the DB returns NotFoundError or InternalError

type Resource

type Resource struct {
	gormsupport.Lifecycle
	ID           uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"`
	ResourceID   string
	PermissionID string
	PolicyID     string
	SpaceID      uuid.UUID `sql:"type:uuid"`
	OwnerID      uuid.UUID `sql:"type:uuid"`
}

Resource represents a Keycloak space resource on the domain and db layer

func (Resource) Equal

func (r Resource) Equal(u convert.Equaler) bool

Equal returns true if two Space Resource objects are equal; otherwise false is returned.

func (Resource) TableName

func (r Resource) TableName() string

TableName implements gorm.tabler

type ResourceRepository

type ResourceRepository interface {
	repository.Exister
	Create(ctx context.Context, space *Resource) (*Resource, error)
	Save(ctx context.Context, space *Resource) (*Resource, error)
	Load(ctx context.Context, ID uuid.UUID) (*Resource, error)
	Delete(ctx context.Context, ID uuid.UUID) error
	LoadBySpace(ctx context.Context, spaceID *uuid.UUID) (*Resource, error)
}

ResourceRepository encapsulate storage & retrieval of space resources

Directories

Path Synopsis
Package authz contains the code that authorizes space operations
Package authz contains the code that authorizes space operations

Jump to

Keyboard shortcuts

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