implement user_permission

This commit is contained in:
2025-02-01 03:04:52 -06:00
parent 72414bc8fb
commit d58c69cb08
6 changed files with 41 additions and 14 deletions

View File

@@ -11,14 +11,19 @@ type KeySelection []int
type CustomerId uuid.UUID
func CustomerIdToString(customerId CustomerId) string {
customerUuid := uuid.UUID(customerId)
return customerUuid.String()
func (c *CustomerId) String() string {
id := uuid.UUID(*c)
return id.String()
}
type SessionId uuid.UUID
type UserId uuid.UUID
func (u *UserId) String() string {
id := uuid.UUID(*u)
return id.String()
}
func UserIdFromString(userId string) UserId {
id, err := uuid.Parse(userId)
if err != nil {
@@ -99,3 +104,14 @@ type LoginInterface struct {
NumbOfKeys int `json:"numb_of_keys"`
Colors []RGBColor `json:"colors"`
}
type UserPermission int
const (
Default UserPermission = iota
Admin
)
func (p UserPermission) String() string {
return [...]string{"Default", "Admin"}[p]
}

View File

@@ -123,11 +123,4 @@ func TestUserInterface_PartialInterfaceShuffle(t *testing.T) {
return n == true
})
assert.False(t, allTrue)
allFalse := all.All[bool](shuffleCompare, func(n bool) bool {
return n == false
})
assert.False(t, allFalse)
}