Core functionality for new aiterp.net servers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
680 B

7 years ago
7 years ago
7 years ago
7 years ago
  1. package auth
  2. type User struct {
  3. ID string
  4. Name string
  5. Level string
  6. Data map[string]string
  7. method Authenticator
  8. loggedOut bool
  9. }
  10. // FullID is the userid prefixed with the method ID
  11. func (user *User) FullID() string {
  12. return user.method.ID() + ":" + user.ID
  13. }
  14. // Logout flags the user for logout
  15. func (user *User) Logout() {
  16. user.loggedOut = true
  17. }
  18. // LoggedOut returns whether the Logout() function has been called
  19. func (user *User) LoggedOut() bool {
  20. return user.loggedOut
  21. }
  22. // NewUser creates a new User object
  23. func NewUser(method Authenticator, id, name, level string, data map[string]string) *User {
  24. return &User{id, name, level, data, method, false}
  25. }