diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-26 15:40:18 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-26 15:40:18 -0700 |
| commit | 187d6dc500784760654b740a278fef59072ca5a8 (patch) | |
| tree | 856f011e322446bf16c0f77e676e82901d0dd93b /hotline/access.go | |
| parent | f168da153f3984af6d532b979219310242f0b8d1 (diff) | |
Refactor user access bitmap handling
Diffstat (limited to 'hotline/access.go')
| -rw-r--r-- | hotline/access.go | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/hotline/access.go b/hotline/access.go index ae72780..83a4e16 100644 --- a/hotline/access.go +++ b/hotline/access.go @@ -1,10 +1,5 @@ package hotline -import ( - "encoding/binary" - "math/big" -) - const ( accessDeleteFile = 0 // File System Maintenance: Can Delete Files accessUploadFile = 1 // File System Maintenance: Can Upload Files @@ -52,10 +47,6 @@ func (bits *accessBitmap) Set(i int) { bits[i/8] |= 1 << uint(7-i%8) } -// authorize checks if 64 bit access slice contain has accessBit set -// TODO: refactor to use accessBitmap type -func authorize(access *[]byte, accessBit int) bool { - bits := big.NewInt(int64(binary.BigEndian.Uint64(*access))) - - return bits.Bit(63-accessBit) == 1 +func (bits *accessBitmap) IsSet(i int) bool { + return bits[i/8]&(1<<uint(7-i%8)) != 0 } |