@@ -192,6 +192,39 @@ func (s *svc) UpdateOCMShare(ctx context.Context, req *ocm.UpdateOCMShareRequest
192
192
return nil , errors .Wrap (err , "gateway: error calling UpdateOCMShare" )
193
193
}
194
194
195
+ gRes , err := c .GetOCMShare (ctx , & ocm.GetOCMShareRequest {
196
+ Ref : req .Ref ,
197
+ })
198
+ if err != nil {
199
+ return nil , errors .Wrap (err , "gateway: error calling GetOCMShare" )
200
+ }
201
+ if gRes .GetStatus ().GetCode () != rpc .Code_CODE_OK {
202
+ return & ocm.UpdateOCMShareResponse {
203
+ Status : gRes .GetStatus (),
204
+ }, nil
205
+ }
206
+
207
+ creator , ok := ctxpkg .ContextGetUser (ctx )
208
+ if ! ok {
209
+ return nil , errors .New ("gateway: user not found in context" )
210
+ }
211
+
212
+ grant := & provider.Grant {
213
+ Grantee : gRes .GetShare ().GetGrantee (),
214
+ Permissions : gRes .GetShare ().GetAccessMethods ()[0 ].GetWebdavOptions ().GetPermissions (),
215
+ Expiration : gRes .GetShare ().GetExpiration (),
216
+ Creator : creator .GetId (),
217
+ }
218
+ updateGrantStatus , err := s .updateGrant (ctx , gRes .GetShare ().GetResourceId (), grant , nil )
219
+ if err != nil {
220
+ return nil , errors .Wrap (err , "gateway: error calling updateGrant" )
221
+ }
222
+ if updateGrantStatus .GetCode () != rpc .Code_CODE_OK {
223
+ return & ocm.UpdateOCMShareResponse {
224
+ Status : updateGrantStatus ,
225
+ }, nil
226
+ }
227
+
195
228
return res , nil
196
229
}
197
230
0 commit comments