Skip to content

Commit 39a7ab7

Browse files
authored
Added/updated methods to manipulate OCM shares and invitees (#211)
1 parent 925898a commit 39a7ab7

File tree

7 files changed

+637
-57
lines changed

7 files changed

+637
-57
lines changed

cs3/gateway/v1beta1/gateway_api.proto

+7-1
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ service GatewayAPI {
384384
rpc GetAcceptedUser(cs3.ocm.invite.v1beta1.GetAcceptedUserRequest) returns (cs3.ocm.invite.v1beta1.GetAcceptedUserResponse);
385385
// Finds users who accepted invite tokens by their attributes.
386386
rpc FindAcceptedUsers(cs3.ocm.invite.v1beta1.FindAcceptedUsersRequest) returns (cs3.ocm.invite.v1beta1.FindAcceptedUsersResponse);
387+
// Delete a previously accepted remote user, that is unfriend that user.
388+
rpc DeleteAcceptedUser(cs3.ocm.invite.v1beta1.DeleteAcceptedUserRequest) returns (cs3.ocm.invite.v1beta1.DeleteAcceptedUserResponse);
387389
// *****************************************************************/
388390
// ******************** OCM PROVIDER AUTHORIZER ********************/
389391
// *****************************************************************/
@@ -400,8 +402,12 @@ service GatewayAPI {
400402
// **************************** OCM CORE ***************************/
401403
// *****************************************************************/
402404

403-
// Creates a new ocm share.
405+
// Creates a new OCM share.
404406
rpc CreateOCMCoreShare(cs3.ocm.core.v1beta1.CreateOCMCoreShareRequest) returns (cs3.ocm.core.v1beta1.CreateOCMCoreShareResponse);
407+
// Updates an OCM share.
408+
rpc UpdateOCMCoreShare(cs3.ocm.core.v1beta1.UpdateOCMCoreShareRequest) returns (cs3.ocm.core.v1beta1.UpdateOCMCoreShareResponse);
409+
// Deletes an OCM share.
410+
rpc DeleteOCMCoreShare(cs3.ocm.core.v1beta1.DeleteOCMCoreShareRequest) returns (cs3.ocm.core.v1beta1.DeleteOCMCoreShareResponse);
405411
// *****************************************************************/
406412
// ************************** FILE TRANSFER ************************/
407413
// *****************************************************************/

cs3/ocm/core/v1beta1/ocm_core_api.proto

+64-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ import "cs3/types/v1beta1/types.proto";
3636

3737
// OCM Core API
3838
//
39-
// The OCM Core API is the mapping in GRPC of the OCM core protocol.
39+
// the OCM Core API is the mapping for the local system of the OCM protocol,
40+
// including multi-protocol shares. Implementations are expected to expose
41+
// the `/ocm` endpoints according to the OCM API, and in response to those
42+
// endpoints implement the following API.
4043
//
4144
// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
4245
// NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
@@ -50,11 +53,17 @@ import "cs3/types/v1beta1/types.proto";
5053
// Any method MAY return UNKNOWN.
5154
// Any method MAY return UNAUTHENTICATED.
5255
service OcmCoreAPI {
53-
// Creates a new ocm share.
56+
// Creates a new OCM share, in response to a call from remote to:
57+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1shares/post
5458
rpc CreateOCMCoreShare(CreateOCMCoreShareRequest) returns (CreateOCMCoreShareResponse);
59+
// Updates an OCM share, in response to a notification from the remote system to:
60+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1notifications/post
61+
rpc UpdateOCMCoreShare(UpdateOCMCoreShareRequest) returns (UpdateOCMCoreShareResponse);
62+
// Deletes an OCM share, in response to a notification from the remote system to:
63+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1notifications/post
64+
rpc DeleteOCMCoreShare(DeleteOCMCoreShareRequest) returns (DeleteOCMCoreShareResponse);
5565
}
5666

57-
// https://rawgit.com/GEANT/OCM-API/v1/docs.html#null%2Fpaths%2F~1shares%2Fpost
5867
message CreateOCMCoreShareRequest {
5968
// OPTIONAL.
6069
// Opaque information.
@@ -87,10 +96,11 @@ message CreateOCMCoreShareRequest {
8796
// Recipient share type.
8897
cs3.sharing.ocm.v1beta1.ShareType share_type = 9;
8998
// OPTIONAL.
90-
// The expiration time for the ocm share.
99+
// The expiration time for the OCM share.
91100
cs3.types.v1beta1.Timestamp expiration = 10;
92101
// REQUIRED.
93-
// The protocols which are used to establish synchronisation.
102+
// The protocols which are used to establish synchronisation,
103+
// with their access rights.
94104
// See also cs3/sharing/ocm/v1beta1/resources.proto for how to map
95105
// this to the OCM share payload.
96106
repeated cs3.sharing.ocm.v1beta1.Protocol protocols = 11;
@@ -109,3 +119,52 @@ message CreateOCMCoreShareResponse {
109119
// REQUIRED.
110120
cs3.types.v1beta1.Timestamp created = 4;
111121
}
122+
123+
message UpdateOCMCoreShareRequest {
124+
// OPTIONAL.
125+
// Opaque information.
126+
cs3.types.v1beta1.Opaque opaque = 1;
127+
// REQUIRED.
128+
// Unique ID to identify the share at the consumer side.
129+
string ocm_share_id = 2;
130+
// OPTIONAL.
131+
// Description for the share.
132+
string description = 3;
133+
// OPTIONAL.
134+
// Recipient share type.
135+
cs3.sharing.ocm.v1beta1.ShareType share_type = 5;
136+
// OPTIONAL.
137+
// The expiration time for the OCM share.
138+
cs3.types.v1beta1.Timestamp expiration = 6;
139+
// OPTIONAL.
140+
// The protocols which are used to establish synchronisation,
141+
// with their access rights.
142+
repeated cs3.sharing.ocm.v1beta1.Protocol protocols = 7;
143+
}
144+
145+
message UpdateOCMCoreShareResponse {
146+
// REQUIRED.
147+
// The response status.
148+
cs3.rpc.v1beta1.Status status = 1;
149+
// OPTIONAL.
150+
// Opaque information.
151+
cs3.types.v1beta1.Opaque opaque = 2;
152+
}
153+
154+
message DeleteOCMCoreShareRequest {
155+
// REQUIRED.
156+
// Unique ID to identify the share at the consumer side.
157+
string id = 1;
158+
// OPTIONAL.
159+
// Opaque information.
160+
cs3.types.v1beta1.Opaque opaque = 2;
161+
}
162+
163+
message DeleteOCMCoreShareResponse {
164+
// REQUIRED.
165+
// The response status.
166+
cs3.rpc.v1beta1.Status status = 1;
167+
// OPTIONAL.
168+
// Opaque information.
169+
cs3.types.v1beta1.Opaque opaque = 2;
170+
}

cs3/ocm/invite/v1beta1/invite_api.proto

+26-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import "cs3/types/v1beta1/types.proto";
3939
// The Invite API is meant to invite users and groups belonging to other
4040
// sync'n'share systems, so that collaboration of resources can be enabled.
4141
//
42+
// The following APIs match the OCM v1.1 spec for the /invite-accepted endpoint.
43+
//
4244
// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
4345
// NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
4446
// "OPTIONAL" in this document are to be interpreted as described in
@@ -55,7 +57,9 @@ service InviteAPI {
5557
rpc GenerateInviteToken(GenerateInviteTokenRequest) returns (GenerateInviteTokenResponse);
5658
// Lists the valid tokens generated by the user.
5759
rpc ListInviteTokens(ListInviteTokensRequest) returns (ListInviteTokensResponse);
58-
// Forwards a received invite to the sync'n'share system provider.
60+
// Forwards a received invite to the remote sync'n'share system provider. The remote
61+
// system SHALL get an `invite-accepted` call as follows:
62+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post
5963
// MUST return CODE_NOT_FOUND if the token does not exist.
6064
// MUST return CODE_INVALID_ARGUMENT if the token expired.
6165
// MUST return CODE_ALREADY_EXISTS if the user already accepted an invite.
@@ -71,6 +75,9 @@ service InviteAPI {
7175
rpc GetAcceptedUser(GetAcceptedUserRequest) returns (GetAcceptedUserResponse);
7276
// Finds users who accepted invite tokens by their attributes.
7377
rpc FindAcceptedUsers(FindAcceptedUsersRequest) returns (FindAcceptedUsersResponse);
78+
// Delete a previously accepted remote user, that is unfriend that user.
79+
// MUST return CODE_NOT_FOUND if the user does not exist.
80+
rpc DeleteAcceptedUser(DeleteAcceptedUserRequest) returns (DeleteAcceptedUserResponse);
7481
}
7582

7683
message GenerateInviteTokenRequest {
@@ -206,3 +213,21 @@ message FindAcceptedUsersResponse {
206213
// The accepted users matching the specified filter.
207214
repeated cs3.identity.user.v1beta1.User accepted_users = 3;
208215
}
216+
217+
message DeleteAcceptedUserRequest {
218+
// OPTIONAL.
219+
// Opaque information.
220+
cs3.types.v1beta1.Opaque opaque = 1;
221+
// REQUIRED.
222+
// The id of the user.
223+
cs3.identity.user.v1beta1.UserId remote_user_id = 2;
224+
}
225+
226+
message DeleteAcceptedUserResponse {
227+
// REQUIRED.
228+
// The response status.
229+
cs3.rpc.v1beta1.Status status = 1;
230+
// OPTIONAL.
231+
// Opaque information.
232+
cs3.types.v1beta1.Opaque opaque = 2;
233+
}

cs3/sharing/ocm/v1beta1/ocm_api.proto

+15-10
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ import "google/protobuf/field_mask.proto";
4242
// resources from the perspective of the creator or the share and
4343
// from the perspective of the receiver of the share.
4444
//
45-
// The following APIs match the OCM v1.1 spec, including the invitation
46-
// workflow and multi-protocol shares.
45+
// The following APIs match the OCM v1.1 spec including multi-protocol shares.
4746
//
4847
// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
4948
// NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
@@ -61,10 +60,15 @@ service OcmAPI {
6160
// MUST return CODE_NOT_FOUND if the resource reference does not exist.
6261
// MUST return CODE_ALREADY_EXISTS if the share already exists for the 4-tuple consisting of
6362
// (owner, shared_resource, grantee).
64-
// New shares MUST be created in the state SHARE_STATE_PENDING.
63+
// New shares MUST be created in the state SHARE_STATE_PENDING, and MUST be sent
64+
// to the remote system using the OCM API at:
65+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1shares/post
6566
rpc CreateOCMShare(CreateOCMShareRequest) returns (CreateOCMShareResponse);
6667
// Removes a share.
6768
// MUST return CODE_NOT_FOUND if the share reference does not exist.
69+
// This action SHALL be notified to the remote system
70+
// using the OCM API at:
71+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1notifications/post
6872
rpc RemoveOCMShare(RemoveOCMShareRequest) returns (RemoveOCMShareResponse);
6973
// Gets share information for a single share.
7074
// MUST return CODE_NOT_FOUND if the share reference does not exist.
@@ -78,6 +82,9 @@ service OcmAPI {
7882
rpc ListOCMShares(ListOCMSharesRequest) returns (ListOCMSharesResponse);
7983
// Updates a share.
8084
// MUST return CODE_NOT_FOUND if the share reference does not exist.
85+
// This action SHALL be notified to the remote system
86+
// using the OCM API at:
87+
// https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1notifications/post
8188
rpc UpdateOCMShare(UpdateOCMShareRequest) returns (UpdateOCMShareResponse);
8289
// List all shares the authenticated principal has received.
8390
rpc ListReceivedOCMShares(ListReceivedOCMSharesRequest) returns (ListReceivedOCMSharesResponse);
@@ -128,21 +135,19 @@ message UpdateOCMShareRequest {
128135
// OPTIONAL.
129136
// Opaque information.
130137
cs3.types.v1beta1.Opaque opaque = 1;
131-
// REQUIRED.
132-
133138
// REQUIRED.
134139
ShareReference ref = 2;
135140
// REQUIRED.
136141
message UpdateField {
137142
// One of the update fields MUST be specified.
138143
oneof field {
139-
// Update the permissions.
140-
SharePermissions permissions = 2;
141-
// Update the display name.
142-
string display_name = 3;
144+
// Update the expiration.
145+
cs3.types.v1beta1.Timestamp expiration = 1;
146+
// Update access methods.
147+
AccessMethod access_methods = 2;
143148
}
144149
}
145-
UpdateField field = 3;
150+
repeated UpdateField field = 3;
146151
}
147152

148153
message UpdateOCMShareResponse {

cs3/sharing/ocm/v1beta1/resources.proto

+9-5
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ message ShareGrant {
224224
SharePermissions permissions = 2;
225225
}
226226

227-
// The protocol which is used to establish synchronisation.
227+
// The protocol which is used to give access to a remote OCM user.
228228
message Protocol {
229229
// REQUIRED.
230230
// One of the protocols MUST be specified.
@@ -287,7 +287,7 @@ enum ShareType {
287287
SHARE_TYPE_GROUP = 2;
288288
}
289289

290-
// Defines how the recipient accesses the share.
290+
// Defines how the recipient accesses an incoming remote OCM share.
291291
message AccessMethod {
292292
// REQUIRED.
293293
// One of the access method MUST be specified.
@@ -308,15 +308,19 @@ message AccessMethod {
308308
message WebDAVAccessMethod {
309309
// REQUIRED.
310310
// The permissions for the share.
311-
storage.provider.v1beta1.ResourcePermissions permissions = 2;
311+
storage.provider.v1beta1.ResourcePermissions permissions = 1;
312312
}
313313

314314
// Defines the options for the Webapp access method.
315315
message WebappAccessMethod {
316316
// REQUIRED.
317317
// The view mode for the share.
318-
cs3.app.provider.v1beta1.ViewMode view_mode = 2;
318+
cs3.app.provider.v1beta1.ViewMode view_mode = 1;
319319
}
320320

321321
// Defines the options for the Transfer access method.
322-
message TransferAccessMethod {}
322+
message TransferAccessMethod {
323+
// REQUIRED.
324+
// The destination path of the data transfer.
325+
storage.provider.v1beta1.Reference destination = 1;
326+
}

0 commit comments

Comments
 (0)