Skip to content

Commit 048f548

Browse files
authored
Merge pull request #5072 from cs3org/fix/eos-versions-grpc-proj
Fix for (sometimes) broken Download / Restore revisions
2 parents 19a7a86 + 63f3b9e commit 048f548

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bugfix: impersonate owner on Revisions
2+
3+
The current implementation of Download / Restore Revisions is not consistent with ListRevisions, where we impersonate the owner in projects. We now also impersonate in the case of Download and Restore.
4+
5+
https://github.com/cs3org/reva/pull/5072

pkg/storage/utils/eosfs/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ type Config struct {
126126
// Only considered when EnableHome is false.
127127
AllowPathRecycleOperations bool `mapstructure:"allow_path_recycle_operations"`
128128

129-
// Whether we should impersonate the owner of a resource when trying to perform
130-
// revisions-related operations.
131-
ImpersonateOwnerforRevisions bool `mapstructure:"impersonate_owner_for_revisions"`
132-
133129
// HTTP connections to EOS: max number of idle conns
134130
MaxIdleConns int `mapstructure:"max_idle_conns"`
135131

pkg/storage/utils/eosfs/eosfs.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ func (fs *eosfs) DownloadRevision(ctx context.Context, ref *provider.Reference,
14641464
var fn string
14651465
var err error
14661466

1467-
if !fs.conf.EnableHome && fs.conf.ImpersonateOwnerforRevisions {
1467+
if !fs.conf.EnableHome {
14681468
// We need to access the revisions for a non-home reference.
14691469
// We'll get the owner of the particular resource and impersonate them
14701470
// if we have access to it.
@@ -1475,7 +1475,8 @@ func (fs *eosfs) DownloadRevision(ctx context.Context, ref *provider.Reference,
14751475
fn = fs.wrap(ctx, md.Path)
14761476

14771477
if md.PermissionSet.InitiateFileDownload {
1478-
auth, err = fs.getUIDGateway(ctx, md.Owner)
1478+
user := appctx.ContextMustGetUser(ctx)
1479+
auth, err = fs.getEOSToken(ctx, user, fn)
14791480
if err != nil {
14801481
return nil, err
14811482
}
@@ -1497,7 +1498,7 @@ func (fs *eosfs) RestoreRevision(ctx context.Context, ref *provider.Reference, r
14971498
var fn string
14981499
var err error
14991500

1500-
if !fs.conf.EnableHome && fs.conf.ImpersonateOwnerforRevisions {
1501+
if !fs.conf.EnableHome {
15011502
// We need to access the revisions for a non-home reference.
15021503
// We'll get the owner of the particular resource and impersonate them
15031504
// if we have access to it.
@@ -1508,7 +1509,8 @@ func (fs *eosfs) RestoreRevision(ctx context.Context, ref *provider.Reference, r
15081509
fn = fs.wrap(ctx, md.Path)
15091510

15101511
if md.PermissionSet.RestoreFileVersion {
1511-
auth, err = fs.getUIDGateway(ctx, md.Owner)
1512+
user := appctx.ContextMustGetUser(ctx)
1513+
auth, err = fs.getEOSToken(ctx, user, fn)
15121514
if err != nil {
15131515
return err
15141516
}

0 commit comments

Comments
 (0)