From 86748fa32b082f1bc29f8a96a0287e9983a46fa9 Mon Sep 17 00:00:00 2001 From: Eccentric Date: Fri, 9 Feb 2024 21:51:26 +0000 Subject: [PATCH] Atomise permissions field in database --- person/permissions.go | 22 ++++++++++++---------- person/person.go | 39 ++++++++++++++------------------------- storage/tables.go | 2 +- 3 files changed, 27 insertions(+), 36 deletions(-) diff --git a/person/permissions.go b/person/permissions.go index 69988b6..6b2d209 100644 --- a/person/permissions.go +++ b/person/permissions.go @@ -1,16 +1,18 @@ package person -type Permission string +type Permission int64 +// DO NOT MOVE THE ORDER OF THESE PERMISSIONS AS THEY ARE USED IN THE DATABASE const ( - PermissionLookup Permission = "lookup" - PermissionBan Permission = "ban" - PermissionInformation Permission = "information" - PermissionDonator Permission = "donator" - PermissionGiveItem Permission = "give_item" - PermissionTakeItem Permission = "take_item" - PermissionReset Permission = "reset" - PermissionFullLocker Permission = "full_locker" + PermissionLookup Permission = 1 << iota + PermissionBan + PermissionInformation + PermissionItemControl + PermissionLockerControl + PermissionPermissionControl + // user roles, not really permissions but implemented as such + PermissionOwner + PermissionDonator - PermissionAll Permission = "all" + PermissionAll Permission = 1<