diff --git a/go.mod b/go.mod index 00cf5c8e7c..c262c1facd 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,6 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 golang.org/x/crypto v0.14.0 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d golang.org/x/net v0.17.0 golang.org/x/sync v0.4.0 gonum.org/v1/gonum v0.14.0 @@ -216,6 +215,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.5.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/pkg/sdk/go/channels.go b/pkg/sdk/go/channels.go index dfa405bfff..0edcc2414d 100644 --- a/pkg/sdk/go/channels.go +++ b/pkg/sdk/go/channels.go @@ -260,7 +260,6 @@ func (sdk mfSDK) ConnectThing(thingID, channelID, token string) errors.SDKError _, _, sdkerr := sdk.processRequest(http.MethodPost, url, token, nil, nil, http.StatusNoContent) return sdkerr - } func (sdk mfSDK) DisconnectThing(thingID, channelID, token string) errors.SDKError { diff --git a/pkg/sdk/go/responses.go b/pkg/sdk/go/responses.go index a42e2f4d9c..cb3a61a44f 100644 --- a/pkg/sdk/go/responses.go +++ b/pkg/sdk/go/responses.go @@ -86,8 +86,3 @@ type SubscriptionPage struct { type identifyThingResp struct { ID string `json:"id,omitempty"` } - -type canAccessRes struct { - ThingID string `json:"thing_id"` - Authorized bool `json:"authorized"` -} diff --git a/things/api/http/clients.go b/things/api/http/clients.go index c05da3ad2c..cc5ff24643 100644 --- a/things/api/http/clients.go +++ b/things/api/http/clients.go @@ -108,7 +108,6 @@ func clientsHandler(svc things.Service, r *chi.Mux, logger mflog.Logger) http.Ha api.EncodeResponse, opts..., ), "thing_delete_share").ServeHTTP) - }) // Ideal location: things service, channels endpoint diff --git a/things/api/http/requests.go b/things/api/http/requests.go index 6fc6616289..6aaf03d8f4 100644 --- a/things/api/http/requests.go +++ b/things/api/http/requests.go @@ -8,7 +8,6 @@ import ( "github.com/mainflux/mainflux/internal/apiutil" mfclients "github.com/mainflux/mainflux/pkg/clients" "github.com/mainflux/mainflux/pkg/errors" - "golang.org/x/exp/slices" ) type createClientReq struct { @@ -208,66 +207,6 @@ func (req changeClientStatusReq) validate() error { return nil } -type assignUsersGroupsRequest struct { - token string - groupID string - Relation string `json:"relation,omitempty"` - MemberKind string `json:"member_kind,omitempty"` - Members []string `json:"members"` -} - -func (req assignUsersGroupsRequest) validate() error { - if req.token == "" { - return apiutil.ErrBearerToken - } - if req.MemberKind == "" { - return apiutil.ErrMissingMemberKind - } - if !slices.Contains([]string{"users", "groups"}, req.MemberKind) { - return apiutil.ErrInvalidMemberKind - } - if req.groupID == "" { - return apiutil.ErrMissingID - } - if len(req.Members) == 0 { - return apiutil.ErrEmptyList - } - - return nil -} - -type unassignUsersGroupsRequest struct { - token string - groupID string - Relation string `json:"relation,omitempty"` - MemberKind string `json:"member_kind,omitempty"` - Members []string `json:"members"` -} - -func (req unassignUsersGroupsRequest) validate() error { - if req.token == "" { - return apiutil.ErrBearerToken - } - - if req.MemberKind == "" { - return apiutil.ErrMissingMemberKind - } - - if !slices.Contains([]string{"users", "groups"}, req.MemberKind) { - return apiutil.ErrInvalidMemberKind - } - - if req.groupID == "" { - return apiutil.ErrMissingID - } - - if len(req.Members) == 0 { - return apiutil.ErrEmptyList - } - - return nil -} - type assignUsersRequest struct { token string groupID string diff --git a/things/service.go b/things/service.go index e46287ab94..0d8c8abe1e 100644 --- a/things/service.go +++ b/things/service.go @@ -205,6 +205,7 @@ func (svc service) filterAllowedThingIDs(ctx context.Context, userID, permission } return ids, nil } + func (svc service) UpdateClient(ctx context.Context, token string, cli mfclients.Client) (mfclients.Client, error) { userID, err := svc.authorize(ctx, userType, tokenKind, token, editPermission, thingType, cli.ID) if err != nil { @@ -309,7 +310,6 @@ func (svc service) Share(ctx context.Context, token, id, relation string, userid } for _, userid := range userids { - addPolicyReq := &mainflux.AddPolicyReq{ SubjectType: userType, Subject: userid, @@ -336,7 +336,6 @@ func (svc service) Unshare(ctx context.Context, token, id, relation string, user } for _, userid := range userids { - delPolicyReq := &mainflux.DeletePolicyReq{ SubjectType: userType, Subject: userid, diff --git a/tools/e2e/e2e.go b/tools/e2e/e2e.go index 987e4efe01..602d55ec23 100644 --- a/tools/e2e/e2e.go +++ b/tools/e2e/e2e.go @@ -463,9 +463,8 @@ func messaging(s sdk.SDK, conf Config, token string, things []sdk.Thing, channel for _, thing := range things { for _, channel := range channels { conn := sdk.Connection{ - ThingID: thing.ID, - ChannelID: channel.ID, - Permission: "publish", + ThingID: thing.ID, + ChannelID: channel.ID, } if err := s.Connect(conn, token); err != nil { return fmt.Errorf("failed to connect thing %s to channel %s", thing.ID, channel.ID) diff --git a/tools/provision/provision.go b/tools/provision/provision.go index 86aafe20da..c098d37223 100644 --- a/tools/provision/provision.go +++ b/tools/provision/provision.go @@ -236,7 +236,6 @@ func Provision(conf Config) error { } } - return nil }