Skip to content

Commit 156848b

Browse files
committed
Set sys_acl to fileinfo directly, not hidden in attrs
1 parent ad0b13f commit 156848b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pkg/eosclient/eosgrpc/eosgrpc.go

+28
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,10 @@ func (c *Client) grpcMDResponseToFileInfo(ctx context.Context, st *erpc.MDRespon
16331633
fi.Attrs[strings.TrimPrefix(k, "user.")] = string(v)
16341634
}
16351635

1636+
if fi.Attrs["sys.acl"] != "" {
1637+
fi.SysACL = aclAttrToAclStruct(fi.Attrs["sys.acl"])
1638+
}
1639+
16361640
fi.TreeSize = uint64(st.Cmd.TreeSize)
16371641
fi.Size = fi.TreeSize
16381642
// TODO(lopresti) this info is missing in the EOS Protobuf, cf. EOS-5974
@@ -1653,6 +1657,10 @@ func (c *Client) grpcMDResponseToFileInfo(ctx context.Context, st *erpc.MDRespon
16531657
fi.Attrs[strings.TrimPrefix(k, "user.")] = string(v)
16541658
}
16551659

1660+
if fi.Attrs["sys.acl"] != "" {
1661+
fi.SysACL = aclAttrToAclStruct(fi.Attrs["sys.acl"])
1662+
}
1663+
16561664
fi.Size = st.Fmd.Size
16571665

16581666
if st.Fmd.Checksum != nil {
@@ -1667,3 +1675,23 @@ func (c *Client) grpcMDResponseToFileInfo(ctx context.Context, st *erpc.MDRespon
16671675
}
16681676
return fi, nil
16691677
}
1678+
1679+
func aclAttrToAclStruct(aclAttr string) *acl.ACLs {
1680+
entries := strings.Split(aclAttr, ",")
1681+
1682+
acl := &acl.ACLs{}
1683+
1684+
for _, entry := range entries {
1685+
parts := strings.Split(entry, ":")
1686+
if len(parts) != 3 {
1687+
continue
1688+
}
1689+
aclType := parts[0]
1690+
qualifier := parts[1]
1691+
permissions := parts[2]
1692+
1693+
acl.SetEntry(aclType, qualifier, permissions)
1694+
}
1695+
1696+
return acl
1697+
}

0 commit comments

Comments
 (0)