Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharestorageprovider oc10 sm #2023

Closed
wants to merge 31 commits into from

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Aug 31, 2021

continuation of #1846 and #1584

@butonic butonic requested a review from labkode as a code owner August 31, 2021 10:05
@update-docs
Copy link

update-docs bot commented Aug 31, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@aduffeck
Copy link
Contributor

aduffeck commented Sep 22, 2021

Following our discussion these are the remaining tasks to implement:

  • Change the ocs API to check for and handle collisions with already existing shares or other nodes on the storage when accepting shares (@butonic, @refs)
  • Extend the sharesstorageprovider to consider all shares pointing to the mountpoint in question, e.g. when renaming or deleting (declining) a share (@butonic, @refs)
  • Make the sql share manager completely hide the fact that accepted group shares can be represented as child shares in the database (@aduffeck)

We also concluded that spaces support will not be implemented as part of this PR.

@refs
Copy link
Member

refs commented Sep 23, 2021

2b9adac (#2023) should address points 1 and 2 from the last comment.

There is however a tradeoff that we made. When there are 2 shares to the same resource, one is a group share and the other a user share, the group share is excluded from the results, so there are not 2 folders to the same location, this is as we discussed.

However, when listing all shares (in the sahred with me tab) we should list both received shares, as the user might want to decline them (i.e update the share state). This is currently not possible since listing the shares (by navigating to /Shares/) uses the same endpoint as the shared with me endpoint, and there is no filtering options to hide shares which point to the same resource.

@aduffeck could you udate the todo list with a checkmark for both tasks? I for some reason am not able to do so :(

//cc @butonic

@aduffeck
Copy link
Contributor

@refs I'm not really following the problem with the same endpoint being used in /Shares and the shared-with-me endpoint. /Shares uses the sharesstorageprovider which talks to the share manager directly and can - and in fact does - merge the two shares to the same resource together, no?

@refs
Copy link
Member

refs commented Sep 23, 2021

@refs I'm not really following the problem with the same endpoint being used in /Shares and the shared-with-me endpoint. /Shares uses the sharesstorageprovider which talks to the share manager directly and can - and in fact does - merge the two shares to the same resource together, no?

@aduffeck What I meant is when we list shares on "Shared with me":

grafik

I think it would be better if we list all of the shares, group and user shares alongside, even if the mount point is the same. And I'm comparing it to this view:

grafik

navigating to /Shares from the web ui actually renders the mount point, but here we should hide the group share (based in: user shares are more explicit, and just hide the less explicit shares, totally my choice, we can decide on this).

The issue comes that these 2 different pages use the same endpoint, and there are currently no filters in the CS3APIS to capture this behavior. What I want is to use the same endpoint and fetch different results depending on where the request was made. Maybe I'm missing an essential part elsewhere 🤷

Status: status.NewStatusFromErrType(ctx, "stat ref: "+req.Ref.String(), err),
}, nil
}
_, _ = io.WriteString(etagHash, childStatRes.Info.Etag)
Copy link
Contributor Author

@butonic butonic Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to check childStatRes.Status.Code != OK or something

@butonic
Copy link
Contributor Author

butonic commented Sep 28, 2021

storage-sharing_1        | {"level":"error","service":"storage","pkg":"rgrpc","error":"Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'results AS\n\t\t(\n\t\t\tSELECT s.*, storages.numeric_id FROM oc_share s\n\t\t\tLEFT JOIN o' at line 1","time":"2021-09-28T10:41:09.102292283Z","caller":"/home/jfd/Repositories/reva/internal/grpc/services/usershareprovider/usershareprovider.go:193","message":"error listing received shares"}

mysql hates us ;-)

@aduffeck aduffeck force-pushed the sharestorageprovider-oc10-sm branch 2 times, most recently from 536219a to 8c5266d Compare September 29, 2021 14:15
@butonic butonic force-pushed the sharestorageprovider-oc10-sm branch 4 times, most recently from d080fdd to 2581441 Compare October 5, 2021 13:32
@lgtm-com
Copy link

lgtm-com bot commented Oct 7, 2021

This pull request introduces 1 alert when merging 18cdc37 into 937db22 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 7, 2021

This pull request introduces 1 alert when merging 52cabec into 937db22 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@aduffeck aduffeck force-pushed the sharestorageprovider-oc10-sm branch from 52cabec to 9e0a31c Compare October 8, 2021 08:42
@lgtm-com
Copy link

lgtm-com bot commented Oct 8, 2021

This pull request introduces 1 alert when merging 1329eb9 into 9be4c4f - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 8, 2021

This pull request introduces 1 alert when merging 3b51cd5 into 9be4c4f - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 26, 2021

This pull request introduces 1 alert when merging 92c6605 into fe35bd1 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 27, 2021

This pull request introduces 1 alert when merging 4f0949d into ab1db2a - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 27, 2021

This pull request introduces 1 alert when merging a5ca0f3 into ab1db2a - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Oct 27, 2021

This pull request introduces 1 alert when merging df6021e into ab1db2a - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@aduffeck aduffeck force-pushed the sharestorageprovider-oc10-sm branch 4 times, most recently from 90c5b4d to a00d562 Compare October 29, 2021 11:53
@butonic
Copy link
Contributor Author

butonic commented Oct 29, 2021

The #2215 (comment) created a really ugly merge conflict: the findEmbeddedMounts() introduced in this PR solves the problem #2215 adresses in a different way. We are going to prepare tests for 'virtual views' and then make sure this PR does not break them.

@butonic butonic mentioned this pull request Nov 4, 2021
Comment on lines 379 to 398
if protocol == "webdav" {
// TODO(ishank011): pass this through the datagateway service
// For now, we just expose the file server to the user
ep, opaque, err := s.webdavRefTransferEndpoint(ctx, statRes.Info.Target)
if err != nil {
return &gateway.InitiateFileDownloadResponse{
Status: status.NewInternal(ctx, err, "gateway: error downloading from webdav host: "+p),
}, nil
}
return &gateway.InitiateFileDownloadResponse{
Status: status.NewOK(ctx),
Protocols: []*gateway.FileDownloadProtocol{
{
Opaque: opaque,
Protocol: "simple",
DownloadEndpoint: ep,
},
},
}, nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishank011 there are several places in the gateway that have special "webdav" handling ... what for? AFAICT it is related to OCM. Unfortunately, there are no tests covering that right now. Well the oc10 core testsuite does cover federated sharing, but the drone ci does not set up a second instance ...

While there are ways forward to cover OCM let's start with what these webdav handling is meant to do? Could you enlighten us?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@butonic yep, the OCM share targets are saved as webdav://$token@$idp?name=$path. When OCM shares are accepted, the references have these targets instead of cs3 for other shares.
When checkRef is called and it detects that the reference is of type 'webdav', the requests are then forwarded to the methods in the webdavstorageprovider.go file, and they actually make the webdav calls to the idp of the share creator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phew ... do you have an example setup with two reva instances that I can use to set up a test environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishank ... um $path? so the references will break when the path changes? Why are we not using ids? Is OCM necessary for your current deployment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the share storage provider will return a cs3 reference which resolves to a yet to be implemented OCM storage provider. That can encapsulate the token and idp data necessary to access the remote instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am currently looking at the /examples/ocmd setup. AFAICT it is deployed next to an existing reva deployment ... is it only starts the ocmd service on the http port ... so normal webdav is not available without an additional reva deployment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started a PR to clean up the toml configs and add an ocm config set in #2239

@butonic butonic marked this pull request as ready for review November 5, 2021 14:06
@butonic butonic requested a review from a team as a code owner November 5, 2021 14:06
}
}
return res, nil
return c.UpdateReceivedShare(ctx, req)
}

func (s *svc) removeReference(ctx context.Context, resourceID *provider.ResourceId) *rpc.Status {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also remove this method?

@@ -96,6 +98,7 @@ func (h *DavHandler) Handler(s *svc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
log := appctx.GetLogger(ctx)
log.Info().Str("request", fmt.Sprintf("%#v", r)).Msg("Got webdav request")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the log?

for j := range rss {
if rss[i].Share.ResourceId.GetOpaqueId() == rss[j].Share.ResourceId.GetOpaqueId() {
if rss[i].Share.GetGrantee().GetType() == provider.GranteeType_GRANTEE_TYPE_GROUP && rss[j].Share.GetGrantee().GetType() == provider.GranteeType_GRANTEE_TYPE_USER {
if rss[i].State == rss[j].State {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this. If the permissions differ for the shares, shouldn't be return both?

requestUserID, _ := router.ShiftPath(requestPath)
u = &userpb.User{
Username: requestUserID,
var requestUsernameOrID string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of comments in the ldap refactor PR #2133. Can you take a look at those?

@butonic
Copy link
Contributor Author

butonic commented Dec 7, 2021

merged in edge as part of #2234

@butonic butonic closed this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants