-
Notifications
You must be signed in to change notification settings - Fork 113
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
update grants in the storage provider on share update #1258
Merged
ishank011
merged 3 commits into
cs3org:master
from
owncloud:update-grants-on-share-update
Oct 20, 2020
Merged
update grants in the storage provider on share update #1258
ishank011
merged 3 commits into
cs3org:master
from
owncloud:update-grants-on-share-update
Oct 20, 2020
Conversation
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
Signed-off-by: David Christofas <[email protected]>
C0rby
force-pushed
the
update-grants-on-share-update
branch
from
October 20, 2020 12:54
52bd784
to
40db8d2
Compare
This pull request introduces 1 alert when merging 40db8d2 into e221f0b - view on LGTM.com new alerts:
|
butonic
previously approved these changes
Oct 20, 2020
Comment on lines
188
to
213
// TODO(labkode): if both commits are enabled they could be done concurrently. | ||
/* | ||
if s.c.CommitShareToStorageGrant { | ||
getShareReq := &collaboration.GetShareRequest{ | ||
Ref: req.Ref, | ||
} | ||
getShareRes, err := c.GetShare(ctx, getShareReq) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "gateway: error calling GetShare") | ||
} | ||
|
||
if getShareRes.Status.Code != rpc.Code_CODE_OK { | ||
return &collaboration.UpdateShareResponse{ | ||
Status: status.NewInternal(ctx, status.NewErrorFromCode(getShareRes.Status.Code, "gateway"), | ||
"error getting share when committing to the share"), | ||
}, nil | ||
} | ||
if s.c.CommitShareToStorageGrant { | ||
getShareReq := &collaboration.GetShareRequest{ | ||
Ref: req.Ref, | ||
} | ||
getShareRes, err := c.GetShare(ctx, getShareReq) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "gateway: error calling GetShare") | ||
} | ||
|
||
grantReq := &provider.UpdateGrantRequest{ | ||
Ref: &provider.Reference{ | ||
Spec: &provider.Reference_Id{ | ||
Id: getShareRes.Share.ResourceId, | ||
}, | ||
}, | ||
Grant: &provider.Grant{ | ||
Grantee: getShareRes.Share.Grantee, | ||
Permissions: getShareRes.Share.Permissions.Permissions, | ||
}, | ||
} | ||
grantRes, err := s.UpdateGrant(ctx, grantReq) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "gateway: error calling UpdateGrant") | ||
} | ||
if grantRes.Status.Code != rpc.Code_CODE_OK { | ||
return &collaboration.UpdateShareResponse{ | ||
Status: status.NewInternal(ctx, status.NewErrorFromCode(grantRes.Status.Code, "gateway"), | ||
"error updating storage grant"), | ||
}, nil | ||
} | ||
if getShareRes.Status.Code != rpc.Code_CODE_OK { | ||
return &collaboration.UpdateShareResponse{ | ||
Status: status.NewInternal(ctx, status.NewErrorFromCode(getShareRes.Status.Code, "gateway"), | ||
"error getting share when committing to the share"), | ||
}, nil | ||
} | ||
updateGrantStatus, err := s.updateGrant(ctx, getShareRes.GetShare().GetResourceId(), | ||
getShareRes.GetShare().GetGrantee(), | ||
getShareRes.GetShare().GetPermissions().GetPermissions()) | ||
if updateGrantStatus.Code != rpc.Code_CODE_OK { | ||
return &collaboration.UpdateShareResponse{ | ||
Status: updateGrantStatus, | ||
}, err | ||
} | ||
*/ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@labkode any reason why this was commented?
Signed-off-by: David Christofas <[email protected]>
Signed-off-by: David Christofas <[email protected]>
3 tasks
ishank011
approved these changes
Oct 20, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The grants set by the ocis storage were not updated when updating a share.
This PR reimplements the code, that was there before but commented out, in a way that is similar to the
addGrant
logic inCreateShare