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

[tests-only] OCM examples cleanup #2751

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions examples/ocmd/ocmd-server-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ ocmcoresvc = "localhost:19000"
ocmshareprovidersvc = "localhost:19000"
ocminvitemanagersvc = "localhost:19000"
ocmproviderauthorizersvc = "localhost:19000"
commit_share_to_storage_grant = false
datagateway = "http://localhost:19001/data"
transfer_expires = 6 # give it a moment
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.authregistry]
driver = "static"
Expand Down Expand Up @@ -80,15 +81,9 @@ driver = "memory"
driver = "static"

[grpc.services.appprovider]
driver = "wopi"
driver = "demo"
app_provider_url = "localhost:19000"

[grpc.services.appprovider.drivers.wopi]
iop_secret = "hello"
wopi_url = "http://0.0.0.0:8880/"
app_name = "Collabora"
app_url = "https://your-collabora-server.org:9980"

[grpc.services.storageprovider]
driver = "localhome"
mount_path = "/home"
Expand Down
3 changes: 2 additions & 1 deletion examples/ocmd/ocmd-server-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ ocmcoresvc = "localhost:17000"
ocmshareprovidersvc = "localhost:17000"
ocminvitemanagersvc = "localhost:17000"
ocmproviderauthorizersvc = "localhost:17000"
commit_share_to_storage_grant = false
datagateway = "http://localhost:17001/data"
transfer_expires = 6 # give it a moment
commit_share_to_storage_grant = true
commit_share_to_storage_ref = true

[grpc.services.authregistry]
driver = "static"
Expand Down
8 changes: 4 additions & 4 deletions examples/ocmd/users.demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"id": {
"opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51",
"idp": "https://cernbox.cern.ch",
"idp": "cernbox.cern.ch",
"type": 1
},
"username": "einstein",
Expand All @@ -28,7 +28,7 @@
{
"id": {
"opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
"idp": "https://cesnet.cz",
"idp": "cesnet.cz",
"type": 1
},
"username": "marie",
Expand All @@ -54,7 +54,7 @@
{
"id": {
"opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c",
"idp": "https://example.org",
"idp": "example.org",
"type": 1
},
"username": "richard",
Expand All @@ -80,7 +80,7 @@
{
"id": {
"opaque_id": "932b4522-139b-4815-8ef4-42cdf82c3d51",
"idp": "https://example.com",
"idp": "example.com",
"type": 1
},
"username": "test",
Expand Down
5 changes: 0 additions & 5 deletions internal/http/services/ocmd/invites.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"mime"
"net/http"
"net/url"
"strings"

userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
invitepb "github.com/cs3org/go-cs3apis/cs3/ocm/invite/v1beta1"
Expand Down Expand Up @@ -239,10 +238,6 @@ func (h *invitesHandler) acceptInvite(w http.ResponseWriter, r *http.Request) {
return
}

if !(strings.Contains(recipientProvider, "://")) {
recipientProvider = "https://" + recipientProvider
}

recipientProviderURL, err := url.Parse(recipientProvider)
if err != nil {
WriteError(w, r, APIErrorServerError, fmt.Sprintf("error parseing recipientProvider URL: %s", recipientProvider), err)
Expand Down
7 changes: 0 additions & 7 deletions pkg/ocm/invite/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ func (m *manager) ForwardInvite(ctx context.Context, invite *invitepb.InviteToke
contextUser := ctxpkg.ContextMustGetUser(ctx)
recipientProvider := contextUser.GetId().GetIdp()

// recipientProvider should be a URL, see https://github.com/cs3org/OCM-API/pull/41/files#diff-9cfca4a1b73e1e28e30fb9b0b984aad6d4caaf0819c61ed40ad338600531f745R569
// And going forward, UserId Idp will also include the https:// prefix, see https://github.com/cs3org/cs3apis/pull/159
// But historically, reva used UserId Idps that were domains instead of full URLs, so we need to support that case too, see
// https://github.com/cs3org/reva/issues/2288
if !(strings.Contains(recipientProvider, "://")) {
recipientProvider = "https://" + recipientProvider
}
requestBody := url.Values{
"token": {invite.GetToken()},
"userID": {contextUser.GetId().GetOpaqueId()},
Expand Down
29 changes: 9 additions & 20 deletions pkg/ocm/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,28 +254,17 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr
}

if isOwnersMeshProvider {
// token, ok := ctxpkg.ContextGetToken(ctx)
// if !ok {
// return nil, errors.New("Could not get token from context")
// }
var protocol map[string]interface{}
protocol := map[string]interface{}{
"name": "webdav",
"options": map[string]string{
"permissions": pm,
"token": ctxpkg.ContextMustGetToken(ctx),
},
}
if st == ocm.Share_SHARE_TYPE_TRANSFER {
protocol = map[string]interface{}{
"name": "datatx",
"options": map[string]string{
"permissions": pm,
"token": token,
},
}
} else {
protocol = map[string]interface{}{
"name": "webdav",
"options": map[string]string{
"permissions": pm,
"token": token,
},
}
protocol["name"] = "datatx"
}

requestBodyMap := map[string]interface{}{
"shareWith": g.Grantee.GetUserId().OpaqueId,
"name": name,
Expand Down