From 24a540caa8369d7edecee97be14f85fa3e4303fd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 15 Feb 2023 21:11:48 +0400 Subject: [PATCH] [#132] cli/util: Fix basic ACL rendering In previous implementation pretty-printer of basic ACL in NeoFS CLI had mistakes: * F-bit was set to `Extendable()` property instead of its inversion * B-bits were set to `acl.RoleInnerRing` rights Make `PrettyPrintTableBACL` to correctly render mentioned bits. Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 1 + cmd/frostfs-cli/modules/util/acl.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6023e5c1b..ae018a335 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Changelog for FrostFS Node - Do not fetch an object if `meta` is missing it (#61) - Create contract wallet only by `init` and `update-config` command (#63) - Actually use `object.put.pool_size_local` and independent pool for local puts (#64). +- Pretty printer of basic ACL in the NeoFS CLI (#2259) ### Removed ### Updated diff --git a/cmd/frostfs-cli/modules/util/acl.go b/cmd/frostfs-cli/modules/util/acl.go index 6620ca705..c8366e5be 100644 --- a/cmd/frostfs-cli/modules/util/acl.go +++ b/cmd/frostfs-cli/modules/util/acl.go @@ -24,7 +24,7 @@ func PrettyPrintTableBACL(cmd *cobra.Command, bacl *acl.Basic) { fmt.Fprintln(w, "\tRangeHASH\tRange\tSearch\tDelete\tPut\tHead\tGet") // Bits bits := []string{ - boolToString(bacl.Sticky()) + " " + boolToString(bacl.Extendable()), + boolToString(bacl.Sticky()) + " " + boolToString(!bacl.Extendable()), getRoleBitsForOperation(bacl, acl.OpObjectHash), getRoleBitsForOperation(bacl, acl.OpObjectRange), getRoleBitsForOperation(bacl, acl.OpObjectSearch), getRoleBitsForOperation(bacl, acl.OpObjectDelete), getRoleBitsForOperation(bacl, acl.OpObjectPut), getRoleBitsForOperation(bacl, acl.OpObjectHead), @@ -47,7 +47,7 @@ func getRoleBitsForOperation(bacl *acl.Basic, op acl.Op) string { return boolToString(bacl.IsOpAllowed(op, acl.RoleOwner)) + " " + boolToString(bacl.IsOpAllowed(op, acl.RoleContainer)) + " " + boolToString(bacl.IsOpAllowed(op, acl.RoleOthers)) + " " + - boolToString(bacl.IsOpAllowed(op, acl.RoleInnerRing)) + boolToString(bacl.AllowedBearerRules(op)) } func boolToString(b bool) string {