Fixes: #8819
This commit is contained in:
Ralf Haferkamp
2024-04-22 17:23:43 +02:00
committed by Ralf Haferkamp
parent d0dd6c8d85
commit 1e5db86900
5 changed files with 12 additions and 8 deletions
@@ -191,7 +191,9 @@ func (s *svc) updateSpaceShare(ctx context.Context, req *collaboration.UpdateSha
return nil, errors.Wrap(err, "gateway: error getting grant to remove from storage")
}
if !isSpaceManagerRemaining(listGrantRes.GetGrants(), grant.GetGrantee()) {
return nil, errors.New("gateway: can't remove the last manager")
return &collaboration.UpdateShareResponse{
Status: status.NewPermissionDenied(ctx, errtypes.PermissionDenied(""), "can't remove the last manager"),
}, nil
}
}
st, err = s.updateGrant(ctx, req.GetShare().GetResourceId(), grant, opaque)
@@ -477,8 +479,7 @@ func (s *svc) removeGrant(ctx context.Context, id *provider.ResourceId, g *provi
return nil, errors.Wrap(err, "gateway: error calling RemoveGrant")
}
if grantRes.Status.Code != rpc.Code_CODE_OK {
return status.NewInternal(ctx,
"error removing storage grant"), nil
return grantRes.GetStatus(), nil
}
return status.NewOK(ctx), nil
@@ -723,7 +724,9 @@ func (s *svc) removeSpaceShare(ctx context.Context, ref *provider.ResourceId, gr
}
if len(listGrantRes.Grants) == 1 || !isSpaceManagerRemaining(listGrantRes.Grants, grantee) {
return nil, errors.New("gateway: can't remove the last manager")
return &collaboration.RemoveShareResponse{
Status: status.NewPermissionDenied(ctx, errtypes.PermissionDenied(""), "can't remove the last manager"),
}, nil
}
// TODO: change CS3 APIs