Skip to content

Commit

Permalink
Change condition for setting sharing permissions from EOS ACLs
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Oct 12, 2021
1 parent 5551534 commit 850a787
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/cbox/storage/eoswrapper/eoswrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@ func (w *wrapper) setProjectSharingPermissions(ctx context.Context, r *provider.
if strings.HasPrefix(w.config.Namespace, eosProjectsNamespace) && (perm.AddGrant || perm.RemoveGrant || perm.UpdateGrant) {
var userHasSharingAccess bool
user := ctxpkg.ContextMustGetUser(ctx)
for _, g := range user.Groups {

for _, g := range user.Groups {
// Check if user is present in the admins or writers groups
if strings.HasPrefix(g, projectSpaceGroupsPrefix) && (strings.HasSuffix(g, projectSpaceAdminGroups) || strings.HasSuffix(g, projectSpaceWriterGroups)) {
userHasSharingAccess = true
break
}
}

if !userHasSharingAccess {
r.PermissionSet.AddGrant = false
r.PermissionSet.RemoveGrant = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/grants/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func GetGrantPermissionSet(perm string, isDir bool) *provider.ResourcePermission
rp.Delete = false
}

if strings.Contains(perm, "m") && !strings.Contains(perm, "!m") {
if strings.Contains(perm, "w") && strings.Contains(perm, "x") && !strings.Contains(perm, "!m") {
rp.AddGrant = true
rp.ListGrants = true
rp.RemoveGrant = true
Expand Down

0 comments on commit 850a787

Please sign in to comment.