mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-26 18:16:47 -05:00
feat(graph): improve logging and tracing for drive item permissions
This commit is contained in:
1 parent
cb3a906cb6
commit
84c784ae67
10 files changed
+2760
-51
No files matched your search
@@ -28,6 +28,11 @@ import (
|
||||
"github.com/opencloud-eu/reva/v2/pkg/share"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storagespace"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/utils"
|
||||
"github.com/rs/zerolog"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
|
||||
"github.com/opencloud-eu/opencloud/pkg/conversions"
|
||||
"github.com/opencloud-eu/opencloud/pkg/l10n"
|
||||
@@ -69,6 +74,7 @@ type DriveItemPermissionsProvider interface {
|
||||
// DriveItemPermissionsService contains the production business logic for everything that relates to permissions on drive items.
|
||||
type DriveItemPermissionsService struct {
|
||||
BaseGraphService
|
||||
tp trace.TracerProvider
|
||||
}
|
||||
|
||||
type permissionType int
|
||||
@@ -90,11 +96,14 @@ type ListPermissionsQueryOptions struct {
|
||||
}
|
||||
|
||||
// NewDriveItemPermissionsService creates a new DriveItemPermissionsService
|
||||
func NewDriveItemPermissionsService(logger log.Logger, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], identityCache cache.IdentityCache, config *config.Config) (DriveItemPermissionsService, error) {
|
||||
func NewDriveItemPermissionsService(logger log.Logger, gatewaySelector pool.Selectable[gateway.GatewayAPIClient], identityCache cache.IdentityCache, config *config.Config, tp trace.TracerProvider) (DriveItemPermissionsService, error) {
|
||||
publicBaseURL, err := url.Parse(config.Spaces.WebDavBase)
|
||||
if err != nil {
|
||||
return DriveItemPermissionsService{}, fmt.Errorf("could not parse graph.spaces.webdav_base: %w", err)
|
||||
}
|
||||
if tp == nil {
|
||||
tp = noop.NewTracerProvider()
|
||||
}
|
||||
return DriveItemPermissionsService{
|
||||
BaseGraphService: BaseGraphService{
|
||||
logger: &log.Logger{Logger: logger.With().Str("graph api", "DrivesDriveItemService").Logger()},
|
||||
@@ -104,25 +113,96 @@ func NewDriveItemPermissionsService(logger log.Logger, gatewaySelector pool.Sele
|
||||
availableRoles: unifiedrole.GetRoles(unifiedrole.RoleFilterIDs(config.UnifiedRoles.AvailableRoles...)),
|
||||
publicBaseURL: publicBaseURL,
|
||||
},
|
||||
tp: tp,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// logLevelForError returns the log level matching the cause of err:
|
||||
// expected client errors are logged at debug level, everything else at error level.
|
||||
// Client errors are the codes errorcode.Error.Render maps to a 4xx status. This is a
|
||||
// default only: call sites that know the operational context better (e.g. a
|
||||
// NOT_FOUND that is part of a lookup chain) should choose their level explicitly.
|
||||
func logLevelForError(err error) zerolog.Level {
|
||||
if e, ok := errorcode.ToError(err); ok {
|
||||
switch e.GetCode() {
|
||||
case errorcode.ItemNotFound, errorcode.AccessDenied, errorcode.InvalidRequest,
|
||||
errorcode.NameAlreadyExists, errorcode.InvalidRange, errorcode.ItemIsLocked,
|
||||
errorcode.PreconditionFailed, errorcode.NotAllowed:
|
||||
return zerolog.DebugLevel
|
||||
}
|
||||
}
|
||||
return zerolog.ErrorLevel
|
||||
}
|
||||
|
||||
// errorCodeForError returns the graph error code err is rendered with. Unlike the error
|
||||
// message, which may contain backend-controlled text, the code is always safe to log.
|
||||
func errorCodeForError(err error) string {
|
||||
if e, ok := errorcode.ToError(err); ok {
|
||||
return e.GetCode().String()
|
||||
}
|
||||
return errorcode.GeneralException.String()
|
||||
}
|
||||
|
||||
// errorEvent starts a log event for err at the level matching its cause. It carries the error
|
||||
// code, callers add the error message only when it cannot contain backend-controlled text.
|
||||
func errorEvent(logger *log.Logger, err error) *zerolog.Event {
|
||||
return logger.WithLevel(logLevelForError(err)).Str("errorCode", errorCodeForError(err))
|
||||
}
|
||||
|
||||
// fallbackErrorEvent starts a log event for err, the error returned after a fallback attempt that
|
||||
// failed with otherErr (which may be nil). The level matches the more severe of both causes, so an
|
||||
// infrastructure failure is not hidden behind the not found of the other attempt. The code of
|
||||
// otherErr is logged under otherKey.
|
||||
func fallbackErrorEvent(logger *log.Logger, err, otherErr error, otherKey string) *zerolog.Event {
|
||||
if otherErr == nil {
|
||||
return errorEvent(logger, err)
|
||||
}
|
||||
level := max(logLevelForError(err), logLevelForError(otherErr))
|
||||
return logger.WithLevel(level).Str("errorCode", errorCodeForError(err)).Str(otherKey, errorCodeForError(otherErr))
|
||||
}
|
||||
|
||||
// endSpan ends span, recording the error code of a failed operation. Like the log level, the span
|
||||
// status only marks unexpected failures as error. The error message is not recorded, it may contain
|
||||
// backend-controlled text.
|
||||
func endSpan(span trace.Span, err error) {
|
||||
if err != nil {
|
||||
span.SetAttributes(semconv.ErrorTypeKey.String(errorCodeForError(err)))
|
||||
setSpanErrorStatus(span, err)
|
||||
}
|
||||
span.End()
|
||||
}
|
||||
|
||||
// setSpanErrorStatus marks span as error when the cause of err is an unexpected failure, with the error
|
||||
// code as description. Call sites that return a different error than the cause use it to keep the cause
|
||||
// visible, endSpan never clears the status again. A nil err leaves the status untouched.
|
||||
func setSpanErrorStatus(span trace.Span, err error) {
|
||||
if err != nil && logLevelForError(err) == zerolog.ErrorLevel {
|
||||
span.SetStatus(codes.Error, errorCodeForError(err))
|
||||
}
|
||||
}
|
||||
|
||||
// Invite invites a user to a drive item.
|
||||
func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
|
||||
func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (_ libregraph.Permission, err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "Invite")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
tenantId := revactx.ContextMustGetUser(ctx).GetId().GetTenantId()
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Err(err).Str("itemID", storagespace.FormatResourceID(resourceId)).Msg("could not select next gateway client")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
statResponse, err := gatewayClient.Stat(ctx, &storageprovider.StatRequest{Ref: &storageprovider.Reference{ResourceId: resourceId}})
|
||||
if err := errorcode.FromStat(statResponse, err); err != nil {
|
||||
s.logger.Warn().Err(err).Interface("stat.res", statResponse).Msg("stat failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Msg("stat failed")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
var condition string
|
||||
if condition, err = roleConditionForResourceType(statResponse.GetInfo()); err != nil {
|
||||
logger.Debug().Err(err).Str("itemID", storagespace.FormatResourceID(resourceId)).Msg("unsupported resource type")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
@@ -130,18 +210,21 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
for _, roleID := range invite.GetRoles() {
|
||||
// only allow roles that are enabled in the config
|
||||
if !slices.Contains(s.config.UnifiedRoles.AvailableRoles, roleID) {
|
||||
logger.Debug().Err(unifiedrole.ErrUnknownRole).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("roleID", roleID).Msg("unknown role")
|
||||
return libregraph.Permission{}, unifiedrole.ErrUnknownRole
|
||||
}
|
||||
|
||||
role, err := unifiedrole.GetRole(unifiedrole.RoleFilterIDs(roleID))
|
||||
if err != nil {
|
||||
s.logger.Debug().Err(err).Interface("role", invite.GetRoles()[0]).Msg("unable to convert requested role")
|
||||
logger.Debug().Err(err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("roleID", roleID).Msg("unable to convert requested role")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
allowedResourceActions := unifiedrole.GetAllowedResourceActions(role, condition)
|
||||
if len(allowedResourceActions) == 0 && role.GetId() != unifiedrole.UnifiedRoleDeniedID {
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "role not applicable to this resource")
|
||||
notApplicableErr := errorcode.New(errorcode.InvalidRequest, "role not applicable to this resource")
|
||||
logger.Debug().Err(notApplicableErr).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("roleID", roleID).Msg("role not applicable to this resource")
|
||||
return libregraph.Permission{}, notApplicableErr
|
||||
}
|
||||
|
||||
unifiedRolePermissions = append(unifiedRolePermissions, conversions.ToPointerSlice(role.GetRolePermissions())...)
|
||||
@@ -167,7 +250,9 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
var cTime *types.Timestamp
|
||||
if email := driveRecipient.GetEmail(); email != "" {
|
||||
if s.config.Commons == nil || !s.config.Commons.EnableGuestLinks {
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.NotSupported, "sharing with mail recipients is not enabled")
|
||||
mailErr := errorcode.New(errorcode.NotSupported, "sharing with mail recipients is not enabled")
|
||||
logger.Debug().Err(mailErr).Str("itemID", storagespace.FormatResourceID(resourceId)).Msg("sharing with mail recipients is not enabled")
|
||||
return libregraph.Permission{}, mailErr
|
||||
}
|
||||
createShareRequest := createShareRequestToMail(email, statResponse.GetInfo(), cs3ResourcePermissions)
|
||||
|
||||
@@ -177,7 +262,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
createShareResponse, err := gatewayClient.CreateShare(ctx, createShareRequest)
|
||||
|
||||
if err := errorcode.FromCS3Status(createShareResponse.GetStatus(), err); err != nil {
|
||||
s.logger.Debug().Err(err).Msg("share creation failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "mail").Msg("share creation failed")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
shareid = createShareResponse.GetShare().GetId().GetOpaqueId()
|
||||
@@ -187,7 +272,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
// the share provider stores the guest's mail address in its canonical form
|
||||
guestIdentity, err := cs3UserIdToIdentity(ctx, s.identityCache, createShareResponse.GetShare().GetGrantee().GetUserId())
|
||||
if err != nil {
|
||||
s.logger.Debug().Err(err).Msg("failed to convert guest user id to identity")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "mail").Msg("failed to convert guest user id to identity")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
@@ -200,7 +285,8 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
case "group":
|
||||
group, err := s.identityCache.GetGroup(ctx, objectID)
|
||||
if err != nil {
|
||||
s.logger.Debug().Err(err).Interface("groupId", objectID).Msg("failed group lookup")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "group").Msg("recipient lookup failed")
|
||||
setSpanErrorStatus(span, err)
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, err.Error())
|
||||
}
|
||||
permission.GrantedToV2 = &libregraph.SharePointIdentitySet{
|
||||
@@ -215,7 +301,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
}
|
||||
createShareResponse, err := gatewayClient.CreateShare(ctx, createShareRequest)
|
||||
if err := errorcode.FromCS3Status(createShareResponse.GetStatus(), err); err != nil {
|
||||
s.logger.Debug().Err(err).Msg("share creation failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "group").Msg("share creation failed")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
shareid = createShareResponse.GetShare().GetId().GetOpaqueId()
|
||||
@@ -226,11 +312,14 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
if errors.Is(err, identity.ErrNotFound) && s.config.IncludeOCMSharees {
|
||||
user, err = s.identityCache.GetAcceptedCS3User(ctx, objectID)
|
||||
if err == nil && IsSpaceRoot(statResponse.GetInfo().GetId()) {
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "federated user can not become a space member")
|
||||
federatedErr := errorcode.New(errorcode.InvalidRequest, "federated user can not become a space member")
|
||||
logger.Debug().Err(federatedErr).Str("itemID", storagespace.FormatResourceID(resourceId)).Msg("federated user can not become a space member")
|
||||
return libregraph.Permission{}, federatedErr
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
s.logger.Debug().Err(err).Interface("userId", objectID).Msg("failed user lookup")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "user").Msg("recipient lookup failed")
|
||||
setSpanErrorStatus(span, err)
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, err.Error())
|
||||
}
|
||||
permission.GrantedToV2 = &libregraph.SharePointIdentitySet{
|
||||
@@ -246,7 +335,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
Domain: user.GetId().GetIdp(),
|
||||
})
|
||||
if err = errorcode.FromCS3Status(providerInfoResp.GetStatus(), err); err != nil {
|
||||
s.logger.Error().Err(err).Msg("getting provider info failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "ocm").Msg("getting provider info failed")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
@@ -256,7 +345,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
}
|
||||
createShareResponse, err := gatewayClient.CreateOCMShare(ctx, createShareRequest)
|
||||
if err = errorcode.FromCS3Status(createShareResponse.GetStatus(), err); err != nil {
|
||||
s.logger.Error().Err(err).Msg("share creation failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "ocm").Msg("share creation failed")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
shareid = createShareResponse.GetShare().GetId().GetOpaqueId()
|
||||
@@ -269,7 +358,7 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
}
|
||||
createShareResponse, err := gatewayClient.CreateShare(ctx, createShareRequest)
|
||||
if err = errorcode.FromCS3Status(createShareResponse.GetStatus(), err); err != nil {
|
||||
s.logger.Error().Err(err).Msg("share creation failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(resourceId)).Str("recipientType", "user").Msg("share creation failed")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
shareid = createShareResponse.GetShare().GetId().GetOpaqueId()
|
||||
@@ -297,7 +386,8 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
if user, ok := revactx.ContextGetUser(ctx); ok {
|
||||
userIdentity, err := userIdToIdentity(ctx, s.identityCache, tenantId, user.GetId().GetOpaqueId())
|
||||
if err != nil {
|
||||
s.logger.Error().Err(err).Msg("identity lookup failed")
|
||||
logger.Error().Str("errorCode", errorCodeForError(err)).Str("itemID", storagespace.FormatResourceID(resourceId)).Msg("identity lookup failed")
|
||||
setSpanErrorStatus(span, err)
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, err.Error())
|
||||
}
|
||||
permission.SetInvitation(libregraph.SharingInvitation{
|
||||
@@ -387,19 +477,28 @@ func createShareRequestToMail(mail string, info *storageprovider.ResourceInfo, c
|
||||
}
|
||||
|
||||
// SpaceRootInvite handles invitation request on project spaces
|
||||
func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
|
||||
func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (_ libregraph.Permission, err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "SpaceRootInvite")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Err(err).Str("driveID", storagespace.FormatResourceID(driveID)).Msg("could not select next gateway client")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
space, err := utils.GetSpace(ctx, storagespace.FormatResourceID(driveID), gatewayClient)
|
||||
if err != nil {
|
||||
return libregraph.Permission{}, errorcode.FromUtilsStatusCodeError(err)
|
||||
spaceErr := errorcode.FromUtilsStatusCodeError(err)
|
||||
errorEvent(&logger, spaceErr).Str("driveID", storagespace.FormatResourceID(driveID)).Msg("could not get space")
|
||||
return libregraph.Permission{}, spaceErr
|
||||
}
|
||||
|
||||
if space.SpaceType != _spaceTypeProject {
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
spaceTypeErr := errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
logger.Debug().Err(spaceTypeErr).Str("driveID", storagespace.FormatResourceID(driveID)).Msg("unsupported space type")
|
||||
return libregraph.Permission{}, spaceTypeErr
|
||||
}
|
||||
|
||||
rootResourceID := space.GetRoot()
|
||||
@@ -407,21 +506,27 @@ func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveI
|
||||
}
|
||||
|
||||
// ListPermissions lists the permissions of a driveItem
|
||||
func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID *storageprovider.ResourceId, queryOptions ListPermissionsQueryOptions) (libregraph.CollectionOfPermissionsWithAllowedValues, error) {
|
||||
func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID *storageprovider.ResourceId, queryOptions ListPermissionsQueryOptions) (_ libregraph.CollectionOfPermissionsWithAllowedValues, err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "ListPermissions")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
collectionOfPermissions := libregraph.CollectionOfPermissionsWithAllowedValues{}
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Err(err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("could not select next gateway client")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
|
||||
statResponse, err := gatewayClient.Stat(ctx, &storageprovider.StatRequest{Ref: &storageprovider.Reference{ResourceId: itemID}})
|
||||
if err := errorcode.FromStat(statResponse, err); err != nil {
|
||||
s.logger.Warn().Err(err).Interface("stat.res", statResponse).Msg("stat failed")
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("stat failed")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
|
||||
var condition string
|
||||
if condition, err = roleConditionForResourceType(statResponse.GetInfo()); err != nil {
|
||||
logger.Debug().Err(err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("unsupported resource type")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
|
||||
@@ -472,6 +577,7 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID
|
||||
share.ResourceIDFilter(itemID),
|
||||
}, driveItems)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("could not list shares")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
} else {
|
||||
@@ -480,6 +586,7 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID
|
||||
share.ResourceIDFilter(itemID),
|
||||
}, driveItems)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("could not list shares")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
if s.config.IncludeOCMSharees {
|
||||
@@ -490,6 +597,7 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID
|
||||
},
|
||||
}, driveItems)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("could not list shares")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
}
|
||||
@@ -501,6 +609,7 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID
|
||||
publicshare.ResourceIDFilter(itemID),
|
||||
}, driveItems)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Msg("could not list shares")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
}
|
||||
@@ -520,21 +629,30 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID
|
||||
}
|
||||
|
||||
// ListSpaceRootPermissions handles ListPermissions request on project spaces
|
||||
func (s DriveItemPermissionsService) ListSpaceRootPermissions(ctx context.Context, driveID *storageprovider.ResourceId, queryOptions ListPermissionsQueryOptions) (libregraph.CollectionOfPermissionsWithAllowedValues, error) {
|
||||
func (s DriveItemPermissionsService) ListSpaceRootPermissions(ctx context.Context, driveID *storageprovider.ResourceId, queryOptions ListPermissionsQueryOptions) (_ libregraph.CollectionOfPermissionsWithAllowedValues, err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "ListSpaceRootPermissions")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
collectionOfPermissions := libregraph.CollectionOfPermissionsWithAllowedValues{}
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Err(err).Str("driveID", storagespace.FormatResourceID(driveID)).Msg("could not select next gateway client")
|
||||
return collectionOfPermissions, err
|
||||
}
|
||||
|
||||
space, err := utils.GetSpace(ctx, storagespace.FormatResourceID(driveID), gatewayClient)
|
||||
if err != nil {
|
||||
return collectionOfPermissions, errorcode.FromUtilsStatusCodeError(err)
|
||||
spaceErr := errorcode.FromUtilsStatusCodeError(err)
|
||||
errorEvent(&logger, spaceErr).Str("driveID", storagespace.FormatResourceID(driveID)).Msg("could not get space")
|
||||
return collectionOfPermissions, spaceErr
|
||||
}
|
||||
|
||||
isSupportedSpaceType := slices.Contains([]string{_spaceTypeProject, _spaceTypePersonal, _spaceTypeVirtual}, space.GetSpaceType())
|
||||
if !isSupportedSpaceType {
|
||||
return collectionOfPermissions, errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
spaceTypeErr := errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
logger.Debug().Err(spaceTypeErr).Str("driveID", storagespace.FormatResourceID(driveID)).Msg("unsupported space type")
|
||||
return collectionOfPermissions, spaceTypeErr
|
||||
}
|
||||
|
||||
rootResourceID := space.GetRoot()
|
||||
@@ -542,7 +660,11 @@ func (s DriveItemPermissionsService) ListSpaceRootPermissions(ctx context.Contex
|
||||
}
|
||||
|
||||
// DeletePermission deletes a permission from a drive item
|
||||
func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) error {
|
||||
func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) (err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "DeletePermission")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
var permissionType permissionType
|
||||
|
||||
sharedResourceID, err := s.getLinkPermissionResourceID(ctx, permissionID)
|
||||
@@ -565,7 +687,10 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
|
||||
}
|
||||
}
|
||||
|
||||
// the ocm lookup replaces the error of the share lookups, keep it for logging
|
||||
var lookupErr error
|
||||
if sharedResourceID == nil && s.config.IncludeOCMSharees {
|
||||
lookupErr = err
|
||||
sharedResourceID, err = s.getOCMPermissionResourceID(ctx, permissionID)
|
||||
if err == nil {
|
||||
permissionType = OCM
|
||||
@@ -574,27 +699,43 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
|
||||
|
||||
switch {
|
||||
case err != nil:
|
||||
fallbackErrorEvent(&logger, err, lookupErr, "lookupErrorCode").Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not resolve permission")
|
||||
setSpanErrorStatus(span, lookupErr)
|
||||
return err
|
||||
case permissionType == Unknown:
|
||||
logger.Debug().Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("permission not found")
|
||||
return errorcode.New(errorcode.ItemNotFound, "permission not found")
|
||||
case sharedResourceID == nil:
|
||||
logger.Debug().Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not resolve the shared resource of the permission")
|
||||
return errorcode.New(errorcode.ItemNotFound, "failed to resolve resource id for shared resource")
|
||||
}
|
||||
|
||||
// The resourceID of the shared resource need to match the item ID from the Request Path
|
||||
// otherwise this is an invalid Request.
|
||||
if !utils.ResourceIDEqual(sharedResourceID, itemID) {
|
||||
s.logger.Debug().Msg("resourceID of shared does not match itemID")
|
||||
logger.Debug().Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("resourceID of shared does not match itemID")
|
||||
return errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match")
|
||||
}
|
||||
|
||||
switch permissionType {
|
||||
case User, Space:
|
||||
return s.removeUserShare(ctx, permissionID)
|
||||
if err := s.removeUserShare(ctx, permissionID); err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not remove permission")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case Public:
|
||||
return s.removePublicShare(ctx, permissionID)
|
||||
if err := s.removePublicShare(ctx, permissionID); err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not remove permission")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
case OCM:
|
||||
return s.removeOCMPermission(ctx, permissionID)
|
||||
if err := s.removeOCMPermission(ctx, permissionID); err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not remove permission")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
// This should never be reached
|
||||
return errorcode.New(errorcode.GeneralException, "failed to delete permission")
|
||||
@@ -602,19 +743,28 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
|
||||
}
|
||||
|
||||
// DeleteSpaceRootPermission deletes a permission on the root item of a project space
|
||||
func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) error {
|
||||
func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) (err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "DeleteSpaceRootPermission")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Err(err).Str("driveID", storagespace.FormatResourceID(driveID)).Str("permissionID", permissionID).Msg("could not select next gateway client")
|
||||
return err
|
||||
}
|
||||
|
||||
space, err := utils.GetSpace(ctx, storagespace.FormatResourceID(driveID), gatewayClient)
|
||||
if err != nil {
|
||||
return errorcode.FromUtilsStatusCodeError(err)
|
||||
spaceErr := errorcode.FromUtilsStatusCodeError(err)
|
||||
errorEvent(&logger, spaceErr).Str("driveID", storagespace.FormatResourceID(driveID)).Str("permissionID", permissionID).Msg("could not get space")
|
||||
return spaceErr
|
||||
}
|
||||
|
||||
if space.SpaceType != _spaceTypeProject {
|
||||
return errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
spaceTypeErr := errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
logger.Debug().Err(spaceTypeErr).Str("driveID", storagespace.FormatResourceID(driveID)).Str("permissionID", permissionID).Msg("unsupported space type")
|
||||
return spaceTypeErr
|
||||
}
|
||||
|
||||
rootResourceID := space.GetRoot()
|
||||
@@ -622,23 +772,32 @@ func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Conte
|
||||
}
|
||||
|
||||
// UpdatePermission updates a permission on a drive item
|
||||
func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) {
|
||||
func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (_ libregraph.Permission, err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "UpdatePermission")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
oldPermission, sharedResourceID, err := s.getPermissionByID(ctx, permissionID, itemID)
|
||||
|
||||
// try to get the permission from ocm if the permission was not found first place
|
||||
// try to get the permission from ocm if the permission was not found first place,
|
||||
// the ocm lookup replaces the error of the share lookup, keep it for logging
|
||||
var lookupErr error
|
||||
if err != nil && s.config.IncludeOCMSharees {
|
||||
lookupErr = err
|
||||
oldPermission, sharedResourceID, err = s.getOCMPermissionByID(ctx, permissionID, itemID)
|
||||
}
|
||||
|
||||
// if we still can't find the permission, return an error
|
||||
if err != nil {
|
||||
fallbackErrorEvent(&logger, err, lookupErr, "lookupErrorCode").Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not resolve permission")
|
||||
setSpanErrorStatus(span, lookupErr)
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
// The resourceID of the shared resource need to match the item ID from the Request Path
|
||||
// otherwise this is an invalid Request.
|
||||
if !utils.ResourceIDEqual(sharedResourceID, itemID) {
|
||||
s.logger.Debug().Msg("resourceID of shared does not match itemID")
|
||||
logger.Debug().Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("resourceID of shared does not match itemID")
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match")
|
||||
}
|
||||
|
||||
@@ -646,6 +805,7 @@ func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemI
|
||||
if _, ok := oldPermission.GetLinkOk(); ok {
|
||||
updatedPermission, err := s.updatePublicLinkPermission(ctx, permissionID, itemID, &newPermission)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not update permission")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
return *updatedPermission, nil
|
||||
@@ -658,31 +818,47 @@ func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemI
|
||||
}
|
||||
|
||||
// This is an ocm share
|
||||
var ocmErr error
|
||||
if s.config.IncludeOCMSharees {
|
||||
updatePermission, err := s.updateOCMPermission(ctx, permissionID, itemID, &newPermission)
|
||||
if err == nil {
|
||||
var updatePermission *libregraph.Permission
|
||||
updatePermission, ocmErr = s.updateOCMPermission(ctx, permissionID, itemID, &newPermission)
|
||||
if ocmErr == nil {
|
||||
return *updatePermission, nil
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// the user share error is returned, but the ocm update may have failed for the more severe cause
|
||||
fallbackErrorEvent(&logger, err, ocmErr, "ocmErrorCode").Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not update permission")
|
||||
setSpanErrorStatus(span, ocmErr)
|
||||
}
|
||||
return libregraph.Permission{}, err
|
||||
|
||||
}
|
||||
|
||||
// UpdateSpaceRootPermission updates a permission on the root item of a project space
|
||||
func (s DriveItemPermissionsService) UpdateSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) {
|
||||
func (s DriveItemPermissionsService) UpdateSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (_ libregraph.Permission, err error) {
|
||||
ctx, span := s.tp.Tracer("graph").Start(ctx, "UpdateSpaceRootPermission")
|
||||
defer func() { endSpan(span, err) }()
|
||||
logger := s.logger.SubloggerWithRequestID(ctx)
|
||||
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Err(err).Str("driveID", storagespace.FormatResourceID(driveID)).Str("permissionID", permissionID).Msg("could not select next gateway client")
|
||||
return libregraph.Permission{}, err
|
||||
}
|
||||
|
||||
space, err := utils.GetSpace(ctx, storagespace.FormatResourceID(driveID), gatewayClient)
|
||||
if err != nil {
|
||||
return libregraph.Permission{}, errorcode.FromUtilsStatusCodeError(err)
|
||||
spaceErr := errorcode.FromUtilsStatusCodeError(err)
|
||||
errorEvent(&logger, spaceErr).Str("driveID", storagespace.FormatResourceID(driveID)).Str("permissionID", permissionID).Msg("could not get space")
|
||||
return libregraph.Permission{}, spaceErr
|
||||
}
|
||||
|
||||
if space.SpaceType != _spaceTypeProject {
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
spaceTypeErr := errorcode.New(errorcode.InvalidRequest, "unsupported space type")
|
||||
logger.Debug().Err(spaceTypeErr).Str("driveID", storagespace.FormatResourceID(driveID)).Str("permissionID", permissionID).Msg("unsupported space type")
|
||||
return libregraph.Permission{}, spaceTypeErr
|
||||
}
|
||||
|
||||
rootResourceID := space.GetRoot()
|
||||
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/render"
|
||||
libregraph "github.com/opencloud-eu/libre-graph-api-go"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/errorcode"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/linktype"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/storagespace"
|
||||
"github.com/opencloud-eu/reva/v2/pkg/utils"
|
||||
libregraph "github.com/opencloud-eu/libre-graph-api-go"
|
||||
)
|
||||
|
||||
func (s DriveItemPermissionsService) CreateLink(ctx context.Context, driveItemID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) {
|
||||
@@ -230,6 +230,8 @@ func (api DriveItemPermissionsApi) SetLinkPassword(w http.ResponseWriter, r *htt
|
||||
|
||||
newPermission, err := api.driveItemPermissionsService.SetPublicLinkPassword(ctx, itemID, permissionID, password.GetPassword())
|
||||
if err != nil {
|
||||
logger := api.logger.SubloggerWithRequestID(ctx)
|
||||
errorEvent(&logger, err).Str("itemID", storagespace.FormatResourceID(itemID)).Str("permissionID", permissionID).Msg("could not set link password")
|
||||
errorcode.RenderError(w, r, err)
|
||||
return
|
||||
}
|
||||
@@ -264,6 +266,8 @@ func (api DriveItemPermissionsApi) SetSpaceRootLinkPassword(w http.ResponseWrite
|
||||
ctx := r.Context()
|
||||
newPermission, err := api.driveItemPermissionsService.SetPublicLinkPasswordOnSpaceRoot(ctx, &driveID, permissionID, password.GetPassword())
|
||||
if err != nil {
|
||||
logger := api.logger.SubloggerWithRequestID(ctx)
|
||||
errorEvent(&logger, err).Str("driveID", storagespace.FormatResourceID(&driveID)).Str("permissionID", permissionID).Msg("could not set link password")
|
||||
errorcode.RenderError(w, r, err)
|
||||
return
|
||||
}
|
||||
@@ -275,7 +279,7 @@ func (api DriveItemPermissionsApi) SetSpaceRootLinkPassword(w http.ResponseWrite
|
||||
func (s DriveItemPermissionsService) updatePublicLinkPermission(ctx context.Context, permissionID string, itemID *storageprovider.ResourceId, newPermission *libregraph.Permission) (perm *libregraph.Permission, err error) {
|
||||
gatewayClient, err := s.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
s.logger.Error().Err(err).Msg("could not select next gateway client")
|
||||
s.logger.Debug().Err(err).Msg("could not select next gateway client")
|
||||
return nil, errorcode.New(errorcode.GeneralException, err.Error())
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ var _ = Describe("createLinkTests", func() {
|
||||
cache := cache.NewIdentityCache(cache.IdentityCacheWithGatewaySelector(gatewaySelector))
|
||||
|
||||
cfg := defaults.FullDefaultConfig()
|
||||
svc, err = service.NewDriveItemPermissionsService(logger, gatewaySelector, cache, cfg)
|
||||
svc, err = service.NewDriveItemPermissionsService(logger, gatewaySelector, cache, cfg, nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
driveItemId = &provider.ResourceId{
|
||||
StorageId: "1",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -267,7 +267,7 @@ func (g BaseGraphService) listSpaceRootUserShares(ctx context.Context, filters [
|
||||
func (g BaseGraphService) listSharesWithSpaceRootFilter(ctx context.Context, spaceRoot bool, filters []*collaboration.Filter, driveItems driveItemsByResourceID) (driveItemsByResourceID, error) {
|
||||
gatewayClient, err := g.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not select next gateway client")
|
||||
g.logger.Debug().Err(err).Msg("could not select next gateway client")
|
||||
return driveItems, errorcode.New(errorcode.GeneralException, err.Error())
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ func (g BaseGraphService) listSharesWithSpaceRootFilter(ctx context.Context, spa
|
||||
func (g BaseGraphService) listOCMShares(ctx context.Context, filters []*ocm.ListOCMSharesRequest_Filter, driveItems driveItemsByResourceID) (driveItemsByResourceID, error) {
|
||||
gatewayClient, err := g.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not select next gateway client")
|
||||
g.logger.Debug().Err(err).Msg("could not select next gateway client")
|
||||
return driveItems, errorcode.New(errorcode.GeneralException, err.Error())
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ func (g BaseGraphService) listPublicShares(ctx context.Context, filters []*link.
|
||||
|
||||
gatewayClient, err := g.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not select next gateway client")
|
||||
g.logger.Debug().Err(err).Msg("could not select next gateway client")
|
||||
return driveItems, errorcode.New(errorcode.GeneralException, err.Error())
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/tidwall/gjson"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/opencloud-eu/opencloud/pkg/log"
|
||||
@@ -104,6 +106,48 @@ var _ = Describe("Graph", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Describe("permissions tracing", func() {
|
||||
It("records a span for the permissions service when a TraceProvider is configured", func() {
|
||||
sr := tracetest.NewSpanRecorder()
|
||||
tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr))
|
||||
DeferCleanup(func() {
|
||||
Expect(tp.Shutdown(context.Background())).To(Succeed())
|
||||
})
|
||||
|
||||
logger := log.NewLogger()
|
||||
m, err := metrics.New(prometheus.NewRegistry(), &logger, func([]string) (string, string) { return "", "" })
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
tracedSvc, err := service.NewService(
|
||||
service.Config(cfg),
|
||||
service.Metrics(m),
|
||||
service.WithGatewaySelector(gatewaySelector),
|
||||
service.EventsPublisher(&eventsPublisher),
|
||||
service.PermissionService(&permissionService),
|
||||
service.TraceProvider(tp),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
}, nil)
|
||||
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1beta1/drives/1$2/root/permissions", nil).WithContext(ctx)
|
||||
tracedSvc.ServeHTTP(rr, r)
|
||||
|
||||
// the request was routed to the permissions service, which looked up the space
|
||||
Expect(rr.Code).To(Equal(http.StatusNotFound))
|
||||
gatewayClient.AssertCalled(GinkgoT(), "ListStorageSpaces", mock.Anything, mock.Anything)
|
||||
// http tracing works with this provider
|
||||
Expect(sr.Ended()).ToNot(BeEmpty())
|
||||
|
||||
var names []string
|
||||
for _, s := range sr.Ended() {
|
||||
names = append(names, s.Name())
|
||||
}
|
||||
Expect(names).To(ContainElement("ListSpaceRootPermissions"))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Drives", func() {
|
||||
Describe("GetDrivesV1 and GetAllDrivesV1", func() {
|
||||
BeforeEach(func() {
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/errorcode"
|
||||
)
|
||||
|
||||
func TestLogLevelForError(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
err error
|
||||
want zerolog.Level
|
||||
}{
|
||||
// expected client errors, rendered as 4xx by errorcode.Error.Render
|
||||
{"item not found", errorcode.New(errorcode.ItemNotFound, "x"), zerolog.DebugLevel},
|
||||
{"access denied", errorcode.New(errorcode.AccessDenied, "x"), zerolog.DebugLevel},
|
||||
{"invalid request", errorcode.New(errorcode.InvalidRequest, "x"), zerolog.DebugLevel},
|
||||
{"name already exists", errorcode.New(errorcode.NameAlreadyExists, "x"), zerolog.DebugLevel},
|
||||
{"invalid range", errorcode.New(errorcode.InvalidRange, "x"), zerolog.DebugLevel},
|
||||
{"item is locked", errorcode.New(errorcode.ItemIsLocked, "x"), zerolog.DebugLevel},
|
||||
{"precondition failed", errorcode.New(errorcode.PreconditionFailed, "x"), zerolog.DebugLevel},
|
||||
{"not allowed", errorcode.New(errorcode.NotAllowed, "x"), zerolog.DebugLevel},
|
||||
{"wrapped item not found", fmt.Errorf("lookup: %w", errorcode.New(errorcode.ItemNotFound, "x")), zerolog.DebugLevel},
|
||||
{"wrapped access denied", fmt.Errorf("lookup: %w", errorcode.New(errorcode.AccessDenied, "x")), zerolog.DebugLevel},
|
||||
|
||||
// unexpected server-side failures
|
||||
{"general exception", errorcode.New(errorcode.GeneralException, "x"), zerolog.ErrorLevel},
|
||||
{"service not available", errorcode.New(errorcode.ServiceNotAvailable, "x"), zerolog.ErrorLevel},
|
||||
{"unauthenticated", errorcode.New(errorcode.Unauthenticated, "x"), zerolog.ErrorLevel},
|
||||
{"quota limit reached", errorcode.New(errorcode.QuotaLimitReached, "x"), zerolog.ErrorLevel},
|
||||
{"not supported", errorcode.New(errorcode.NotSupported, "x"), zerolog.ErrorLevel},
|
||||
{"wrapped general exception", fmt.Errorf("stat: %w", errorcode.New(errorcode.GeneralException, "x")), zerolog.ErrorLevel},
|
||||
{"plain error", errors.New("connection refused"), zerolog.ErrorLevel},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
assert.Equal(t, tc.want, logLevelForError(tc.err))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrorCodeForError(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
err error
|
||||
want string
|
||||
}{
|
||||
{"graph error", errorcode.New(errorcode.ItemNotFound, "private-file.txt"), "itemNotFound"},
|
||||
{"wrapped graph error", fmt.Errorf("stat: %w", errorcode.New(errorcode.ServiceNotAvailable, "x")), "serviceNotAvailable"},
|
||||
// errorcode.RenderError renders untyped errors as generalException
|
||||
{"plain error", errors.New("connection refused"), "generalException"},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
assert.Equal(t, tc.want, errorCodeForError(tc.err))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestLogLevelForErrorMatchesRenderedStatus keeps logLevelForError in sync with errorcode.Error.Render:
|
||||
// every code rendered as a 4xx is an expected client error, everything else is unexpected.
|
||||
func TestLogLevelForErrorMatchesRenderedStatus(t *testing.T) {
|
||||
// ItemIsLocked is the last declared error code
|
||||
for code := errorcode.AccessDenied; code <= errorcode.ItemIsLocked; code++ {
|
||||
t.Run(code.String(), func(t *testing.T) {
|
||||
rr := httptest.NewRecorder()
|
||||
errorcode.New(code, "x").Render(rr, httptest.NewRequest(http.MethodGet, "/", nil))
|
||||
|
||||
want := zerolog.ErrorLevel
|
||||
if rr.Code >= http.StatusBadRequest && rr.Code < http.StatusInternalServerError {
|
||||
want = zerolog.DebugLevel
|
||||
}
|
||||
assert.Equal(t, want, logLevelForError(errorcode.New(code, "x")), "rendered status %d", rr.Code)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ func NewService(opts ...Option) (Graph, error) { //nolint:maintidx
|
||||
return Graph{}, err
|
||||
}
|
||||
|
||||
driveItemPermissionsService, err := NewDriveItemPermissionsService(options.Logger, options.GatewaySelector, identityCache, options.Config)
|
||||
driveItemPermissionsService, err := NewDriveItemPermissionsService(options.Logger, options.GatewaySelector, identityCache, options.Config, options.TraceProvider)
|
||||
if err != nil {
|
||||
return Graph{}, err
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@ type driveItemsByResourceID map[string]libregraph.DriveItem
|
||||
|
||||
// GetSharedByMe implements the Service interface (/me/drives/sharedByMe endpoint)
|
||||
func (g Graph) GetSharedByMe(w http.ResponseWriter, r *http.Request) {
|
||||
g.logger.Debug().Msg("Calling GetRootDriveChildren")
|
||||
ctx := r.Context()
|
||||
logger := g.logger.SubloggerWithRequestID(ctx)
|
||||
logger.Debug().Msg("Calling GetRootDriveChildren")
|
||||
|
||||
driveItems, err := g.listUserShares(ctx, nil, make(driveItemsByResourceID))
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Msg("could not list shares")
|
||||
errorcode.RenderError(w, r, err)
|
||||
return
|
||||
}
|
||||
@@ -27,6 +29,7 @@ func (g Graph) GetSharedByMe(w http.ResponseWriter, r *http.Request) {
|
||||
if g.config.IncludeOCMSharees {
|
||||
driveItems, err = g.listOCMShares(ctx, nil, driveItems)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Msg("could not list shares")
|
||||
errorcode.RenderError(w, r, err)
|
||||
return
|
||||
}
|
||||
@@ -34,6 +37,7 @@ func (g Graph) GetSharedByMe(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
driveItems, err = g.listPublicShares(ctx, nil, driveItems)
|
||||
if err != nil {
|
||||
errorEvent(&logger, err).Msg("could not list shares")
|
||||
errorcode.RenderError(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package svc_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -14,7 +15,9 @@ import (
|
||||
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
libregraph "github.com/opencloud-eu/libre-graph-api-go"
|
||||
@@ -25,6 +28,7 @@ import (
|
||||
"github.com/opencloud-eu/reva/v2/pkg/utils"
|
||||
cs3mocks "github.com/opencloud-eu/reva/v2/tests/cs3mocks/mocks"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
@@ -33,6 +37,7 @@ import (
|
||||
"github.com/opencloud-eu/opencloud/services/graph/mocks"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/config"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/config/defaults"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/errorcode"
|
||||
identitymocks "github.com/opencloud-eu/opencloud/services/graph/pkg/identity/mocks"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/linktype"
|
||||
"github.com/opencloud-eu/opencloud/services/graph/pkg/metrics"
|
||||
@@ -279,6 +284,236 @@ var _ = Describe("sharedbyme", func() {
|
||||
nil,
|
||||
)
|
||||
}
|
||||
Describe("GetSharedByMe logging", func() {
|
||||
var logBuf *bytes.Buffer
|
||||
|
||||
newLoggedService := func(selector pool.Selectable[gateway.GatewayAPIClient]) service.Service {
|
||||
logBuf = &bytes.Buffer{}
|
||||
logger := log.NewLogger()
|
||||
m, err := metrics.New(prometheus.NewRegistry(), &logger, func([]string) (string, string) { return "", "" })
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
s, err := service.NewService(
|
||||
service.Config(cfg),
|
||||
service.Metrics(m),
|
||||
service.WithGatewaySelector(selector),
|
||||
service.EventsPublisher(&eventsPublisher),
|
||||
service.WithIdentityBackend(identityBackend),
|
||||
service.Logger(log.Logger{Logger: zerolog.New(logBuf)}),
|
||||
)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return s
|
||||
}
|
||||
errorEntries := func() []map[string]any {
|
||||
return entriesAtLevel(logEntries(logBuf), "error")
|
||||
}
|
||||
odataError := func() libregraph.OdataError {
|
||||
var odataErr libregraph.OdataError
|
||||
Expect(json.Unmarshal(rr.Body.Bytes(), &odataErr)).To(Succeed())
|
||||
return odataErr
|
||||
}
|
||||
|
||||
It("logs a gateway selection failure while listing shares once as error", func() {
|
||||
failingSelector := mocks.NewSelectable[gateway.GatewayAPIClient](GinkgoT())
|
||||
failingSelector.EXPECT().Next().Return(nil, errors.New("no gateway available"))
|
||||
s := newLoggedService(failingSelector)
|
||||
|
||||
s.GetSharedByMe(rr, httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil))
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
Expect(odataError().Error.Message).To(Equal("no gateway available"))
|
||||
Expect(errorEntries()).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("logs a share listing failure once as error", func() {
|
||||
emptyListPublicSharesMock()
|
||||
gatewayClient.On("ListShares", mock.Anything, mock.Anything).Return(
|
||||
&collaboration.ListSharesResponse{Status: status.NewInternal(ctx, "error listing shares")},
|
||||
nil,
|
||||
)
|
||||
s := newLoggedService(gatewaySelector)
|
||||
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil)
|
||||
s.GetSharedByMe(rr, r.WithContext(context.WithValue(r.Context(), middleware.RequestIDKey, "request-42")))
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
Expect(odataError().Error.Message).To(Equal("error listing shares"))
|
||||
entries := errorEntries()
|
||||
Expect(entries).To(HaveLen(1))
|
||||
Expect(entries[0]).To(SatisfyAll(
|
||||
Not(HaveKey("error")),
|
||||
HaveKeyWithValue("errorCode", "generalException"),
|
||||
HaveKeyWithValue("request-id", "request-42"),
|
||||
))
|
||||
})
|
||||
|
||||
DescribeTable("does not log identity backend text when a share grantee lookup fails",
|
||||
func(setup func(identityClient *cs3mocks.GatewayAPIClient, resourceID *provider.ResourceId, groupGrantee *provider.Grantee), listingMethod string) {
|
||||
const identityBackendMessage = "ldap search failed for cn=private-group-dn-42,ou=groups"
|
||||
identityClient := cs3mocks.NewGatewayAPIClient(GinkgoT())
|
||||
selector := mocks.NewSelectable[gateway.GatewayAPIClient](GinkgoT())
|
||||
selector.EXPECT().Next().Return(identityClient, nil)
|
||||
resourceID := &provider.ResourceId{StorageId: "storageid", SpaceId: "spaceid", OpaqueId: "opaqueid"}
|
||||
groupGrantee := &provider.Grantee{
|
||||
Type: provider.GranteeType_GRANTEE_TYPE_GROUP,
|
||||
Id: &provider.Grantee_GroupId{GroupId: &grouppb.GroupId{OpaqueId: "groupid"}},
|
||||
}
|
||||
setup(identityClient, resourceID, groupGrantee)
|
||||
identityClient.On("Stat", mock.Anything, mock.Anything).Return(&provider.StatResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Info: &provider.ResourceInfo{Id: resourceID, Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER},
|
||||
}, nil)
|
||||
identityClient.On("GetGroup", mock.Anything, mock.Anything).Return(&grouppb.GetGroupResponse{
|
||||
Status: status.NewInternal(ctx, identityBackendMessage),
|
||||
}, nil)
|
||||
s := newLoggedService(selector)
|
||||
|
||||
s.GetSharedByMe(rr, httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil))
|
||||
|
||||
// the rendered error is unchanged
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
Expect(odataError().Error.Message).To(Equal(
|
||||
errorcode.New(errorcode.GeneralException,
|
||||
errorcode.New(errorcode.GeneralException, identityBackendMessage).Error()).Error()))
|
||||
// the shares were listed and the group grantee was looked up, listing stops before the public shares
|
||||
identityClient.AssertCalled(GinkgoT(), listingMethod, mock.Anything, mock.Anything)
|
||||
identityClient.AssertCalled(GinkgoT(), "GetGroup", mock.Anything, mock.MatchedBy(func(req *grouppb.GetGroupRequest) bool {
|
||||
return req.GetGroupId().GetOpaqueId() == "groupid"
|
||||
}))
|
||||
identityClient.AssertNotCalled(GinkgoT(), "ListPublicShares", mock.Anything, mock.Anything)
|
||||
|
||||
entries := logEntries(logBuf)
|
||||
errorEntries := entriesAtLevel(entries, "error")
|
||||
Expect(errorEntries).To(HaveLen(1))
|
||||
for _, payloadKey := range []string{"shares", "share", "group", "res", "response"} {
|
||||
Expect(entries).ToNot(ContainElement(HaveKey(payloadKey)))
|
||||
}
|
||||
// neither the identity value nor the backend message reach the log
|
||||
raw, err := json.Marshal(entries)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(raw)).ToNot(ContainSubstring("private-group-dn-42"))
|
||||
Expect(string(raw)).ToNot(ContainSubstring("ldap search failed"))
|
||||
},
|
||||
Entry("user share listing",
|
||||
func(identityClient *cs3mocks.GatewayAPIClient, resourceID *provider.ResourceId, groupGrantee *provider.Grantee) {
|
||||
identityClient.On("ListShares", mock.Anything, mock.Anything).Return(&collaboration.ListSharesResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Shares: []*collaboration.Share{{
|
||||
Id: &collaboration.ShareId{OpaqueId: "groupshareid"},
|
||||
ResourceId: resourceID,
|
||||
Grantee: groupGrantee,
|
||||
Permissions: &collaboration.SharePermissions{Permissions: editorResourcePermissions},
|
||||
}},
|
||||
}, nil)
|
||||
},
|
||||
"ListShares",
|
||||
),
|
||||
Entry("ocm share listing",
|
||||
func(identityClient *cs3mocks.GatewayAPIClient, resourceID *provider.ResourceId, groupGrantee *provider.Grantee) {
|
||||
cfg.IncludeOCMSharees = true
|
||||
identityClient.On("ListShares", mock.Anything, mock.Anything).Return(&collaboration.ListSharesResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Shares: []*collaboration.Share{},
|
||||
}, nil)
|
||||
identityClient.On("ListOCMShares", mock.Anything, mock.Anything).Return(&ocm.ListOCMSharesResponse{
|
||||
Status: status.NewOK(ctx),
|
||||
Shares: []*ocm.Share{{
|
||||
Id: &ocm.ShareId{OpaqueId: "ocmgroupshareid"},
|
||||
ResourceId: resourceID,
|
||||
Grantee: groupGrantee,
|
||||
}},
|
||||
}, nil)
|
||||
},
|
||||
"ListOCMShares",
|
||||
),
|
||||
)
|
||||
|
||||
It("logs an ocm share listing failure once as error", func() {
|
||||
cfg.IncludeOCMSharees = true
|
||||
emptyListSharesMock()
|
||||
gatewayClient.On("ListOCMShares", mock.Anything, mock.Anything).Return(
|
||||
&ocm.ListOCMSharesResponse{Status: status.NewInternal(ctx, "error listing ocm shares")},
|
||||
nil,
|
||||
)
|
||||
s := newLoggedService(gatewaySelector)
|
||||
|
||||
s.GetSharedByMe(rr, httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil))
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
Expect(odataError().Error.Message).To(Equal("error listing ocm shares"))
|
||||
gatewayClient.AssertNotCalled(GinkgoT(), "ListPublicShares", mock.Anything, mock.Anything)
|
||||
entries := errorEntries()
|
||||
Expect(entries).To(HaveLen(1))
|
||||
Expect(entries[0]).ToNot(HaveKey("error"))
|
||||
})
|
||||
|
||||
It("logs a gateway selection failure while listing ocm shares once as error", func() {
|
||||
cfg.IncludeOCMSharees = true
|
||||
emptyListSharesMock()
|
||||
// the user share listing gets a client, the ocm share listing does not
|
||||
selector := mocks.NewSelectable[gateway.GatewayAPIClient](GinkgoT())
|
||||
selector.EXPECT().Next().Return(gatewayClient, nil).Times(1)
|
||||
selector.EXPECT().Next().Return(nil, errors.New("no gateway available")).Times(1)
|
||||
s := newLoggedService(selector)
|
||||
|
||||
s.GetSharedByMe(rr, httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil))
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
Expect(odataError().Error.Message).To(Equal("no gateway available"))
|
||||
gatewayClient.AssertCalled(GinkgoT(), "ListShares", mock.Anything, mock.Anything)
|
||||
gatewayClient.AssertNotCalled(GinkgoT(), "ListOCMShares", mock.Anything, mock.Anything)
|
||||
Expect(errorEntries()).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("logs a public share listing failure once as error", func() {
|
||||
emptyListSharesMock()
|
||||
gatewayClient.On("ListPublicShares", mock.Anything, mock.Anything).Return(
|
||||
&link.ListPublicSharesResponse{Status: status.NewInternal(ctx, "listing failed for /Users/alice/Private/salary-2026.ods")},
|
||||
nil,
|
||||
)
|
||||
s := newLoggedService(gatewaySelector)
|
||||
|
||||
s.GetSharedByMe(rr, httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil))
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
// the response is unchanged, only the log omits the backend message
|
||||
Expect(odataError().Error.Message).To(Equal("listing failed for /Users/alice/Private/salary-2026.ods"))
|
||||
gatewayClient.AssertCalled(GinkgoT(), "ListShares", mock.Anything, mock.Anything)
|
||||
all := logEntries(logBuf)
|
||||
entries := entriesAtLevel(all, "error")
|
||||
Expect(entries).To(HaveLen(1))
|
||||
Expect(entries[0]).To(SatisfyAll(
|
||||
HaveKeyWithValue("errorCode", "generalException"),
|
||||
Not(HaveKey("error")),
|
||||
))
|
||||
// the backend status message is not logged at any level
|
||||
Expect(rawLog(all)).ToNot(ContainSubstring("salary-2026.ods"))
|
||||
})
|
||||
|
||||
It("logs a gateway selection failure while listing public shares once as error", func() {
|
||||
emptyListSharesMock()
|
||||
// the user share listing gets a client, the public share listing does not
|
||||
selector := mocks.NewSelectable[gateway.GatewayAPIClient](GinkgoT())
|
||||
selector.EXPECT().Next().Return(gatewayClient, nil).Times(1)
|
||||
selector.EXPECT().Next().Return(nil, errors.New("no gateway available")).Times(1)
|
||||
s := newLoggedService(selector)
|
||||
|
||||
s.GetSharedByMe(rr, httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drives/sharedByMe", nil))
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
Expect(odataError().Error.Code).To(Equal("generalException"))
|
||||
Expect(odataError().Error.Message).To(Equal("no gateway available"))
|
||||
gatewayClient.AssertCalled(GinkgoT(), "ListShares", mock.Anything, mock.Anything)
|
||||
gatewayClient.AssertNotCalled(GinkgoT(), "ListPublicShares", mock.Anything, mock.Anything)
|
||||
Expect(errorEntries()).To(HaveLen(1))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("GetSharedByMe", func() {
|
||||
It("handles a failing ListShares", func() {
|
||||
emptyListPublicSharesMock()
|
||||
|
||||
Reference in new issue
Block a user