aboutsummaryrefslogtreecommitdiff
path: root/hotline/access.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2021-07-28 18:21:52 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2021-07-28 14:21:52 -0700
commit22c599abc18895f73e96095f35b71cf3357d41b4 (patch)
tree482ef57d386c955692ea43c43e4655b3c3763499 /hotline/access.go
parent71c56068adca18f76ebee86355f000a3e51d3127 (diff)
Move code to hotline dir
Diffstat (limited to 'hotline/access.go')
-rw-r--r--hotline/access.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/hotline/access.go b/hotline/access.go
new file mode 100644
index 0000000..21b438f
--- /dev/null
+++ b/hotline/access.go
@@ -0,0 +1,59 @@
+package hotline
+
+import (
+ "encoding/binary"
+ "math/big"
+)
+
+const (
+ accessAlwaysAllow = -1 // Some transactions are always allowed
+
+ // File System Maintenance
+ accessDeleteFile = 0
+ accessUploadFile = 1
+ accessDownloadFile = 2 // Can Download Files
+ accessRenameFile = 3
+ accessMoveFile = 4
+ accessCreateFolder = 5
+ accessDeleteFolder = 6
+ accessRenameFolder = 7
+ accessMoveFolder = 8
+ accessReadChat = 9
+ accessSendChat = 10
+ accessOpenChat = 11
+ // accessCloseChat = 12 // Documented but unused?
+ // accessShowInList = 13 // Documented but unused?
+ accessCreateUser = 14
+ accessDeleteUser = 15
+ accessOpenUser = 16
+ accessModifyUser = 17
+ // accessChangeOwnPass = 18 // Documented but unused?
+ accessSendPrivMsg = 19 // This doesn't do what it seems like it should do. TODO: Investigate
+ accessNewsReadArt = 20
+ accessNewsPostArt = 21
+ accessDisconUser = 22 // Toggles red user name in user list
+ accessCannotBeDiscon = 23
+ accessGetClientInfo = 24
+ accessUploadAnywhere = 25
+ accessAnyName = 26
+ accessNoAgreement = 27
+ accessSetFileComment = 28
+ accessSetFolderComment = 29
+ accessViewDropBoxes = 30
+ accessMakeAlias = 31
+ accessBroadcast = 32
+ accessNewsDeleteArt = 33
+ accessNewsCreateCat = 34
+ accessNewsDeleteCat = 35
+ accessNewsCreateFldr = 36
+ accessNewsDeleteFldr = 37
+)
+
+func authorize(access *[]byte, accessBit int) bool {
+ if accessBit == accessAlwaysAllow {
+ return true
+ }
+ accessBitmap := big.NewInt(int64(binary.BigEndian.Uint64(*access)))
+
+ return accessBitmap.Bit(63-accessBit) == 1
+}