useropr.go 820 B

12345678910111213141516171819202122232425262728293031323334
  1. package user
  2. import (
  3. "fmt"
  4. "imuslab.com/arozos/mod/info/logger"
  5. )
  6. // Get the user's handler
  7. func (u *User) Parent() *UserHandler {
  8. return u.parent
  9. }
  10. // Remove the current user
  11. func (u *User) RemoveUser() {
  12. //Remove the user storage quota settings
  13. logger.PrintAndLog("User", fmt.Sprint("Removing User Quota: ", u.Username), nil)
  14. u.StorageQuota.RemoveUserQuota()
  15. //Remove the user authentication register
  16. u.parent.authAgent.UnregisterUser(u.Username)
  17. }
  18. // Get the target user icon
  19. func (u *User) GetUserIcon() string {
  20. var userIconpath []byte
  21. u.parent.database.Read("auth", "profilepic/"+u.Username, &userIconpath)
  22. return string(userIconpath)
  23. }
  24. // Set the current user icon
  25. func (u *User) SetUserIcon(base64data string) {
  26. u.parent.database.Write("auth", "profilepic/"+u.Username, []byte(base64data))
  27. }