refactor permissions service to make creating drives testable

This commit is contained in:
Michael Barz
2022-11-15 22:22:58 +01:00
parent d9fa7455b6
commit fd562b36b5
7 changed files with 172 additions and 28 deletions

View File

@@ -15,6 +15,7 @@ import (
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
"github.com/owncloud/ocis/v2/services/graph/pkg/identity"
"go-micro.dev/v4/client"
mevents "go-micro.dev/v4/events"
"google.golang.org/grpc"
)
@@ -62,6 +63,11 @@ type Publisher interface {
Publish(string, interface{}, ...mevents.PublishOption) error
}
type Permissions interface {
GetPermissionByID(ctx context.Context, request *settingssvc.GetPermissionByIDRequest, opts ...client.CallOption) (*settingssvc.GetPermissionByIDResponse, error)
ListPermissionsByResource(ctx context.Context, in *settingssvc.ListPermissionsByResourceRequest, opts ...client.CallOption) (*settingssvc.ListPermissionsByResourceResponse, error)
}
// HTTPClient is the subset of the http.Client that is being used to interact with the download gateway
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)