Skip to content

Commit

Permalink
Minor optimization in parsing EOS ACLs (#1855)
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 authored Jul 2, 2021
1 parent 9a5bc73 commit 57da362
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/eos-acl-optimization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Minor optimization in parsing EOS ACLs

https://github.com/cs3org/reva/pull/1855
2 changes: 1 addition & 1 deletion cmd/reva/ocm-invite-forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func ocmInviteForwardCommand() *command {
return errors.New("token cannot be empty: use -token flag\n" + cmd.Usage())
}
if *idp == "" {
return errors.New("Provider domain cannot be empty: use -provider flag\n" + cmd.Usage())
return errors.New("Provider domain cannot be empty: use -idp flag\n" + cmd.Usage())
}

ctx := getAuthContext()
Expand Down
12 changes: 8 additions & 4 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1520,12 +1520,16 @@ func (fs *eosfs) permissionSet(ctx context.Context, eosFileInfo *eosclient.FileI
var perm provider.ResourcePermissions
for _, e := range eosFileInfo.SysACL.Entries {
var userInGroup bool
for _, g := range u.Groups {
if e.Qualifier == g {
userInGroup = true
if e.Type == acl.TypeGroup {
for _, g := range u.Groups {
if e.Qualifier == g {
userInGroup = true
break
}
}
}
if e.Qualifier == uid || userInGroup {

if (e.Type == acl.TypeUser && e.Qualifier == uid) || userInGroup {
mergePermissions(&perm, grants.GetGrantPermissionSet(e.Permissions, eosFileInfo.IsDir))
}
}
Expand Down

0 comments on commit 57da362

Please sign in to comment.