[#225] container: Replace basic ACL code to a separate package

Create `acl` package inside `container` path. Replace basic ACL
functionality into it.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-06-20 18:28:27 +03:00 committed by fyrchik
parent e82a2d86ef
commit c4ebe8d854
14 changed files with 524 additions and 499 deletions

30
container/acl/init.go Normal file
View file

@ -0,0 +1,30 @@
package acl
func init() {
// left-to-right order of the object operations
orderedOps := [...]Op{
OpObjectGet,
OpObjectHead,
OpObjectPut,
OpObjectDelete,
OpObjectSearch,
OpObjectRange,
OpObjectHash,
}
mOrder = make(map[Op]uint8, len(orderedOps))
for i := range orderedOps {
mOrder[orderedOps[i]] = uint8(i)
}
// numbers are taken from NeoFS Specification
Private.FromBits(0x1C8C8CCC)
PrivateExtended.FromBits(0x0C8C8CCC)
PublicRO.FromBits(0x1FBF8CFF)
PublicROExtended.FromBits(0x0FBF8CFF)
PublicRW.FromBits(0x1FBFBFFF)
PublicRWExtended.FromBits(0x0FBFBFFF)
PublicAppend.FromBits(0x1FBF9FFF)
PublicAppendExtended.FromBits(0x0FBF9FFF)
}