out.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package user // import "imuslab.com/arozos/mod/user"
  2. TYPES
  3. type User struct {
  4. Username string
  5. StorageQuota *quota.QuotaHandler
  6. PermissionGroup []*permission.PermissionGroup
  7. HomeDirectories *storage.StoragePool
  8. // Has unexported fields.
  9. }
  10. func (u *User) CanRead(vpath string) bool
  11. Helper function for checking permission
  12. func (u *User) CanWrite(vpath string) bool
  13. func (u *User) GetAllFileSystemHandler() []*fs.FileSystemHandler
  14. func (u *User) GetFileOwner(realpath string) string
  15. func (u *User) GetFileSystemHandlerFromRealPath(rpath string) (*fs.FileSystemHandler, error)
  16. func (u *User) GetFileSystemHandlerFromVirtualPath(vpath string) (*fs.FileSystemHandler, error)
  17. Get a file system handler from a virtual path, this file system handler
  18. might not be the highest prioity one
  19. func (u *User) GetHighestAccessRightStoragePool(fsUUID string) (*storage.StoragePool, error)
  20. Get the highest access right to the given fs uuid
  21. func (u *User) GetHomeDirectory() (string, error)
  22. func (u *User) GetInterfaceModules() []string
  23. Get the (or a list of ) Interface Module (aka booting module) for this user,
  24. returning module uuids
  25. func (u *User) GetModuleAccessPermission(moduleName string) bool
  26. Permissions related to modules
  27. func (u *User) GetPathAccessPermission(vpath string) string
  28. Check if the user has access to this virthal filepath
  29. func (u *User) GetUserIcon() string
  30. Get the current user icon
  31. func (u *User) GetUserPermissionGroup() []*permission.PermissionGroup
  32. func (u *User) HaveSpaceFor(realpath string) bool
  33. Return the user quota information, returning used / total
  34. func (u *User) IsAdmin() bool
  35. func (u *User) IsOwnerOfFile(realpath string) bool
  36. func (u *User) Parent() *UserHandler
  37. func (u *User) RealPathToVirtualPath(rpath string) (string, error)
  38. func (u *User) RemoveOwnershipFromFile(realpath string) error
  39. func (u *User) RemoveUser()
  40. Remove the current user
  41. func (u *User) SetOwnerOfFile(realpath string) error
  42. func (u *User) SetUserIcon(base64data string)
  43. Set the current user icon
  44. func (u *User) SetUserPermissionGroup(groups []*permission.PermissionGroup)
  45. func (u *User) UserIsInOneOfTheGroupOf(groupnames []string) bool
  46. Check if the user is in one of the permission groups, require groupname
  47. func (u *User) VirtualPathToRealPath(vpath string) (string, error)
  48. type UserHandler struct {
  49. // Has unexported fields.
  50. }
  51. func NewUserHandler(systemdb *db.Database, authAgent *auth.AuthAgent, permissionHandler *permission.PermissionHandler, baseStoragePool *storage.StoragePool) (*UserHandler, error)
  52. Initiate a new user handler
  53. func (u *UserHandler) GetAuthAgent() *auth.AuthAgent
  54. Return the user handler's auth agent
  55. func (u *UserHandler) GetDatabase() *db.Database
  56. func (u *UserHandler) GetPermissionHandler() *permission.PermissionHandler
  57. func (u *UserHandler) GetStoragePool() *storage.StoragePool
  58. func (u *UserHandler) GetUserInfoFromRequest(w http.ResponseWriter, r *http.Request) (*User, error)
  59. Get user obejct from session
  60. func (u *UserHandler) GetUserInfoFromUsername(username string) (*User, error)
  61. Get User object from username
  62. func (u *UserHandler) UpdateStoragePool(newpool *storage.StoragePool)