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.

30 lines
654 B

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