This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
forked from cs3org/reva
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update OCM shares to last version of CS3APIs (cs3org#3646)
* rewritten new share endpoint according to new ocm specs * add go validator dependency * add new share to ocm client * defined ocm repository * rewrote ocm core * rewrote ocm share provider * removed commented code * fixed app provider with new cs3apis * rewrote ocmshareprovider * fix commands * add share type * add token * add expiration time to ocm shares * refactor * do not set ctime and mtime of share in json driver * set ctime and mtime of ocm share on creation * pass user obj * removed old files * refactored nextcloud ocm share driver * removed unused variable * add commands to get info about ocm share * generate crypto secure random string * fixes in json pkg * fix linting * add randutil pkg * fixes * expose recipient display name * fixes in json parsing * fix function name * add helper functions for tests * fix response when creating new ocm share * fix errors in ocm share provider (still internal error) * improved spawn revad daemons for testing. it's possible now define files with initial content and empty folders used by config files * defined integration tests for ocm shares * fixes in other tests * use fork for go cs3 bindings * fix typo * fix linter * add changelog * fix linter x2 * return correct errors according to specs * add other tests and bugfixes * fix linter * fix cmd for creating ocm shares
- Loading branch information
Showing
51 changed files
with
3,550 additions
and
2,238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Enhancement: Update OCM shares to last version of CS3APIs | ||
|
||
https://github.com/cs3org/reva/pull/3646 | ||
https://github.com/cs3org/cs3apis/pull/199 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2018-2023 CERN | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// In applying this license, CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
package main | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"io" | ||
|
||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" | ||
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" | ||
"github.com/cs3org/reva/pkg/utils" | ||
) | ||
|
||
func ocmShareGetReceivedCommand() *command { | ||
cmd := newCommand("ocm-share-get-received") | ||
cmd.Description = func() string { return "get the info of the OCM share you have received" } | ||
cmd.Usage = func() string { return "Usage: ocm-share-get-received" } | ||
cmd.Action = func(w ...io.Writer) error { | ||
if cmd.NArg() < 1 { | ||
return errors.New("Invalid arguments: " + cmd.Usage()) | ||
} | ||
|
||
ctx := getAuthContext() | ||
client, err := getClient() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
id := cmd.Arg(0) | ||
|
||
shareRes, err := client.GetReceivedOCMShare(ctx, &ocm.GetReceivedOCMShareRequest{ | ||
Ref: &ocm.ShareReference{ | ||
Spec: &ocm.ShareReference_Id{ | ||
Id: &ocm.ShareId{ | ||
OpaqueId: id, | ||
}, | ||
}, | ||
}, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
if shareRes.Status.Code != rpc.Code_CODE_OK { | ||
return formatError(shareRes.Status) | ||
} | ||
|
||
d, err := utils.MarshalProtoV1ToJSON(shareRes.Share) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println(string(d)) | ||
|
||
return nil | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2018-2023 CERN | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// In applying this license, CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
package main | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"io" | ||
|
||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" | ||
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" | ||
"github.com/cs3org/reva/pkg/utils" | ||
) | ||
|
||
func ocmShareGetCommand() *command { | ||
cmd := newCommand("ocm-share-get") | ||
cmd.Description = func() string { return "get the info of the OCM share" } | ||
cmd.Usage = func() string { return "Usage: ocm-share-get" } | ||
cmd.Action = func(w ...io.Writer) error { | ||
if cmd.NArg() < 1 { | ||
return errors.New("Invalid arguments: " + cmd.Usage()) | ||
} | ||
|
||
ctx := getAuthContext() | ||
client, err := getClient() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
id := cmd.Arg(0) | ||
|
||
shareRes, err := client.GetOCMShare(ctx, &ocm.GetOCMShareRequest{ | ||
Ref: &ocm.ShareReference{ | ||
Spec: &ocm.ShareReference_Id{ | ||
Id: &ocm.ShareId{ | ||
OpaqueId: id, | ||
}, | ||
}, | ||
}, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
if shareRes.Status.Code != rpc.Code_CODE_OK { | ||
return formatError(shareRes.Status) | ||
} | ||
|
||
d, err := utils.MarshalProtoV1ToJSON(shareRes.Share) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println(string(d)) | ||
|
||
return nil | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.