mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-29 13:49:28 +08:00

* Change CanAccess to CanAccessByKey for things Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Change CanAccess in remaining occurances Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Regenerate generated files Signed-off-by: Nick Neisen <nwneisen@gmail.com> * Generate pb.go files with protoc 3.6.1 Signed-off-by: Nick Neisen <nwneisen@gmail.com>
45 lines
697 B
Go
45 lines
697 B
Go
// Copyright (c) Mainflux
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package grpc
|
|
|
|
import "github.com/mainflux/mainflux/things"
|
|
|
|
type AccessByKeyReq struct {
|
|
thingKey string
|
|
chanID string
|
|
}
|
|
|
|
func (req AccessByKeyReq) validate() error {
|
|
if req.chanID == "" || req.thingKey == "" {
|
|
return things.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type accessByIDReq struct {
|
|
thingID string
|
|
chanID string
|
|
}
|
|
|
|
func (req accessByIDReq) validate() error {
|
|
if req.thingID == "" || req.chanID == "" {
|
|
return things.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type identifyReq struct {
|
|
key string
|
|
}
|
|
|
|
func (req identifyReq) validate() error {
|
|
if req.key == "" {
|
|
return things.ErrMalformedEntity
|
|
}
|
|
|
|
return nil
|
|
}
|