/
requests.go
49 lines (38 loc) · 1.04 KB
/
requests.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
// Adapted for Orb project, modifications licensed under MPL v. 2.0:
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
package grpc
import "github.com/orb-community/orb/policies"
type accessByIDReq struct {
PolicyID string
OwnerID string
}
func (req accessByIDReq) validate() error {
if req.PolicyID == "" || req.OwnerID == "" {
return policies.ErrMalformedEntity
}
return nil
}
type accessByGroupIDReq struct {
GroupIDs []string
OwnerID string
}
func (req accessByGroupIDReq) validate() error {
if len(req.GroupIDs) == 0 || req.OwnerID == "" {
return policies.ErrMalformedEntity
}
return nil
}
type accessDatasetByIDReq struct {
datasetID string
ownerID string
}
func (req accessDatasetByIDReq) validate() error {
if req.datasetID == "" || req.ownerID == "" {
return policies.ErrMalformedEntity
}
return nil
}