controller

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Com

type Com interface {
	ResourcesEffectedByUserDelete(token auth.Token, resource string) (deleteResourceIds []string, deleteUserFromResourceIds []string, err error)
	GetResourceOwner(token auth.Token, kind string, id string, rights string) (owner string, found bool, err error)
	GetPermissions(token auth.Token, kind string, id string) (permmodel.ResourceRights, error)

	GetTechnicalDeviceGroup(token auth.Token, id string) (dt models.DeviceGroup, err error, code int)
	ValidateDeviceGroup(token auth.Token, dt models.DeviceGroup) (err error, code int)
	PermissionCheckForDeviceGroup(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"

	GetDeviceType(token auth.Token, id string) (dt models.DeviceType, err error, code int)
	ValidateDeviceType(token auth.Token, dt models.DeviceType) (err error, code int)
	PermissionCheckForDeviceType(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"

	GetProtocol(token auth.Token, id string) (models.Protocol, error, int)
	ValidateProtocol(token auth.Token, protocol models.Protocol) (err error, code int)

	GetDevice(token auth.Token, id string) (models.Device, error, int) //uses internal admin jwt
	ValidateDevice(token auth.Token, device models.Device) (err error, code int)
	PermissionCheckForDevice(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"
	PermissionCheckForDeviceList(token auth.Token, ids []string, rights string) (result map[string]bool, err error, code int)

	GetHub(token auth.Token, id string) (models.Hub, error, int) //uses internal admin jwt
	ValidateHub(token auth.Token, hub models.Hub) (err error, code int)
	PermissionCheckForHub(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"

	GetConcept(token auth.Token, id string) (models.Concept, error, int)
	ValidateConcept(token auth.Token, concept models.Concept) (err error, code int)
	PermissionCheckForConcept(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"

	ValidateCharacteristic(token auth.Token, concept models.Characteristic) (err error, code int)
	PermissionCheckForCharacteristic(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"
	GetCharacteristic(token auth.Token, id string) (concept models.Characteristic, err error, code int)

	DevicesOfTypeExist(token auth.Token, deviceTypeId string) (result bool, err error, code int)

	DeviceLocalIdToId(token auth.Token, localId string) (id string, err error, code int)

	GetAspect(token auth.Token, id string) (models.Aspect, error, int)
	ValidateAspect(token auth.Token, aspect models.Aspect) (err error, code int)

	GetFunction(token auth.Token, id string) (models.Function, error, int)
	ValidateFunction(token auth.Token, function models.Function) (err error, code int)

	GetDeviceClass(token auth.Token, id string) (models.DeviceClass, error, int)
	ValidateDeviceClass(token auth.Token, deviceClass models.DeviceClass) (err error, code int)

	GetLocation(token auth.Token, id string) (models.Location, error, int)
	ValidateLocation(token auth.Token, Location models.Location) (err error, code int)
	PermissionCheckForLocation(token auth.Token, id string, permission string) (err error, code int) //permission = "w" | "r" | "x" | "a"

	ValidateAspectDelete(token auth.Token, id string) (err error, code int)
	ValidateCharacteristicDelete(token auth.Token, id string) (err error, code int)
	ValidateConceptDelete(token auth.Token, id string) (err error, code int)
	ValidateDeviceClassDelete(token auth.Token, id string) (err error, code int)
	ValidateFunctionDelete(token auth.Token, id string) (err error, code int)

	QueryPermissionsSearch(token string, query com.QueryMessage, result interface{}) (err error, code int)
}

type Controller

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

func New

func New(basectx context.Context, conf config.Config) (ctrl *Controller, err error)

func NewWithPublisher

func NewWithPublisher(conf config.Config, publisher Publisher) (*Controller, error)

func (*Controller) DeleteUser

func (this *Controller) DeleteUser(userId string) error

func (*Controller) DeviceLocalIdToId

func (this *Controller) DeviceLocalIdToId(token auth.Token, localId string) (id string, err error, errCode int)

func (*Controller) GetPublisher

func (this *Controller) GetPublisher() Publisher

func (*Controller) PublishAspectCreate

func (this *Controller) PublishAspectCreate(token auth.Token, aspect models.Aspect) (models.Aspect, error, int)

func (*Controller) PublishAspectDelete

func (this *Controller) PublishAspectDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishAspectUpdate

func (this *Controller) PublishAspectUpdate(token auth.Token, id string, aspect models.Aspect) (models.Aspect, error, int)

func (*Controller) PublishCharacteristicCreate

func (this *Controller) PublishCharacteristicCreate(token auth.Token, characteristic models.Characteristic) (models.Characteristic, error, int)

func (*Controller) PublishCharacteristicDelete

func (this *Controller) PublishCharacteristicDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishCharacteristicUpdate

func (this *Controller) PublishCharacteristicUpdate(token auth.Token, characteristicId string, characteristic models.Characteristic) (models.Characteristic, error, int)

func (*Controller) PublishConceptCreate

func (this *Controller) PublishConceptCreate(token auth.Token, concept models.Concept) (models.Concept, error, int)

func (*Controller) PublishConceptDelete

func (this *Controller) PublishConceptDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishConceptUpdate

func (this *Controller) PublishConceptUpdate(token auth.Token, id string, concept models.Concept) (models.Concept, error, int)

func (*Controller) PublishDeviceClassCreate

func (this *Controller) PublishDeviceClassCreate(token auth.Token, deviceClass models.DeviceClass) (models.DeviceClass, error, int)

func (*Controller) PublishDeviceClassDelete

func (this *Controller) PublishDeviceClassDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishDeviceClassUpdate

func (this *Controller) PublishDeviceClassUpdate(token auth.Token, id string, deviceClass models.DeviceClass) (models.DeviceClass, error, int)

func (*Controller) PublishDeviceCreate

func (this *Controller) PublishDeviceCreate(token auth.Token, device models.Device) (models.Device, error, int)

func (*Controller) PublishDeviceDelete

func (this *Controller) PublishDeviceDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishDeviceGroupCreate

func (this *Controller) PublishDeviceGroupCreate(token auth.Token, dg models.DeviceGroup) (result models.DeviceGroup, err error, code int)

func (*Controller) PublishDeviceGroupDelete

func (this *Controller) PublishDeviceGroupDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishDeviceGroupUpdate

func (this *Controller) PublishDeviceGroupUpdate(token auth.Token, id string, dg models.DeviceGroup) (result models.DeviceGroup, err error, code int)

func (*Controller) PublishDeviceTypeCreate

func (this *Controller) PublishDeviceTypeCreate(token auth.Token, dt models.DeviceType) (models.DeviceType, error, int)

func (*Controller) PublishDeviceTypeDelete

func (this *Controller) PublishDeviceTypeDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishDeviceTypeUpdate

func (this *Controller) PublishDeviceTypeUpdate(token auth.Token, id string, dt models.DeviceType) (models.DeviceType, error, int)

func (*Controller) PublishDeviceUpdate

func (this *Controller) PublishDeviceUpdate(token auth.Token, id string, device models.Device, options model.DeviceUpdateOptions) (_ models.Device, err error, code int)

admins may create new devices but only without setting options.UpdateOnlySameOriginAttributes

func (*Controller) PublishFunctionCreate

func (this *Controller) PublishFunctionCreate(token auth.Token, function models.Function) (models.Function, error, int)

func (*Controller) PublishFunctionDelete

func (this *Controller) PublishFunctionDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishFunctionUpdate

func (this *Controller) PublishFunctionUpdate(token auth.Token, id string, function models.Function) (models.Function, error, int)

func (*Controller) PublishHubCreate

func (this *Controller) PublishHubCreate(token auth.Token, hubEdit models.HubEdit) (models.Hub, error, int)

func (*Controller) PublishHubDelete

func (this *Controller) PublishHubDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishHubUpdate

func (this *Controller) PublishHubUpdate(token auth.Token, id string, userId string, hubEdit models.HubEdit) (models.Hub, error, int)

func (*Controller) PublishLocationCreate

func (this *Controller) PublishLocationCreate(token auth.Token, location models.Location) (result models.Location, err error, code int)

func (*Controller) PublishLocationDelete

func (this *Controller) PublishLocationDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishLocationUpdate

func (this *Controller) PublishLocationUpdate(token auth.Token, id string, location models.Location) (models.Location, error, int)

func (*Controller) PublishProtocolCreate

func (this *Controller) PublishProtocolCreate(token auth.Token, protocol models.Protocol) (models.Protocol, error, int)

func (*Controller) PublishProtocolDelete

func (this *Controller) PublishProtocolDelete(token auth.Token, id string) (error, int)

func (*Controller) PublishProtocolUpdate

func (this *Controller) PublishProtocolUpdate(token auth.Token, id string, protocol models.Protocol) (models.Protocol, error, int)

func (*Controller) ReadAspect

func (this *Controller) ReadAspect(token auth.Token, id string) (aspect models.Aspect, err error, code int)

func (*Controller) ReadCharacteristic

func (this *Controller) ReadCharacteristic(token auth.Token, id string) (result models.Characteristic, err error, code int)

func (*Controller) ReadConcept

func (this *Controller) ReadConcept(token auth.Token, id string) (concept models.Concept, err error, code int)

func (*Controller) ReadDevice

func (this *Controller) ReadDevice(token auth.Token, id string) (device models.Device, err error, code int)

func (*Controller) ReadDeviceClass

func (this *Controller) ReadDeviceClass(token auth.Token, id string) (deviceClass models.DeviceClass, err error, code int)

func (*Controller) ReadDeviceGroup

func (this *Controller) ReadDeviceGroup(token auth.Token, id string) (dt models.DeviceGroup, err error, code int)

func (*Controller) ReadDeviceType

func (this *Controller) ReadDeviceType(token auth.Token, id string) (dt models.DeviceType, err error, code int)

func (*Controller) ReadFunction

func (this *Controller) ReadFunction(token auth.Token, id string) (function models.Function, err error, code int)

func (*Controller) ReadHub

func (this *Controller) ReadHub(token auth.Token, id string) (hub models.Hub, err error, code int)

func (*Controller) ReadLocation

func (this *Controller) ReadLocation(token auth.Token, id string) (location models.Location, err error, code int)

func (*Controller) ReadProtocol

func (this *Controller) ReadProtocol(token auth.Token, id string) (protocol models.Protocol, err error, code int)

func (*Controller) ValidateDistinctDeviceTypeAttributes

func (this *Controller) ValidateDistinctDeviceTypeAttributes(token auth.Token, devicetype models.DeviceType, attributeKeys []string) error

type IdWrapper

type IdWrapper struct {
	Id string `json:"id"`
}

type Publisher

type Publisher interface {
	PublishDevice(device models.Device, userID string) (err error)
	PublishDeviceDelete(id string, userID string) error

	PublishDeviceType(device models.DeviceType, userID string) (err error)
	PublishDeviceTypeDelete(id string, userID string) error

	PublishDeviceGroup(device models.DeviceGroup, userID string) (err error)
	PublishDeviceGroupDelete(id string, userID string) error

	PublishProtocol(device models.Protocol, userID string) (err error)
	PublishProtocolDelete(id string, userID string) error

	PublishHub(hub models.Hub, userID string) (err error)
	PublishHubDelete(id string, userID string) error

	PublishConcept(concept models.Concept, userID string) (err error)
	PublishConceptDelete(id string, userID string) error

	PublishCharacteristic(characteristic models.Characteristic, userID string) (err error)
	PublishCharacteristicDelete(id string, userID string) error

	PublishAspect(device models.Aspect, userID string) (err error)
	PublishAspectDelete(id string, userID string) error

	PublishFunction(device models.Function, userID string) (err error)
	PublishFunctionDelete(id string, userID string) error

	PublishDeviceClass(device models.DeviceClass, userID string) (err error)
	PublishDeviceClassDelete(id string, userID string) error

	PublishLocation(device models.Location, userID string) (err error)
	PublishLocationDelete(id string, userID string) error

	PublishRights(kind string, id string, element permmodel.ResourceRightsBase) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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