implement user_permission
This commit is contained in:
@@ -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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user