mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-20 09:16:40 +00:00
add example setup for management refactor
This commit is contained in:
35
management/refactor/users/user.go
Normal file
35
management/refactor/users/user.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package users
|
||||
|
||||
import "time"
|
||||
|
||||
// UserRole is the role of a User
|
||||
type UserRole string
|
||||
|
||||
type User interface {
|
||||
IsBlocked() bool
|
||||
}
|
||||
|
||||
// User represents a user of the system
|
||||
type DefaultUser struct {
|
||||
Id string `gorm:"primaryKey"`
|
||||
// AccountID is a reference to Account that this object belongs
|
||||
AccountID string `json:"-" gorm:"index"`
|
||||
Role UserRole
|
||||
IsServiceUser bool
|
||||
// NonDeletable indicates whether the service user can be deleted
|
||||
NonDeletable bool
|
||||
// ServiceUserName is only set if IsServiceUser is true
|
||||
ServiceUserName string
|
||||
// AutoGroups is a list of Group IDs to auto-assign to peers registered by this user
|
||||
AutoGroups []string `gorm:"serializer:json"`
|
||||
// Blocked indicates whether the user is blocked. Blocked users can't use the system.
|
||||
Blocked bool
|
||||
// LastLogin is the last time the user logged in to IdP
|
||||
LastLogin time.Time
|
||||
// Issued of the user
|
||||
Issued string `gorm:"default:api"`
|
||||
}
|
||||
|
||||
func (u *DefaultUser) IsBlocked() bool {
|
||||
return u.Blocked
|
||||
}
|
||||
Reference in New Issue
Block a user