mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-31 10:38:51 -04:00
feat: expose the default project space quota in the capabilities
This commit is contained in:
1 parent
38262408d6
commit
6adeacf8ce
4 files changed
+19
-6
No files matched your search
@@ -26,6 +26,7 @@ type Config struct {
|
||||
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"FRONTEND_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token." introductionVersion:"1.0.0"`
|
||||
|
||||
MaxQuota uint64 `yaml:"max_quota" env:"OC_SPACES_MAX_QUOTA;FRONTEND_MAX_QUOTA" desc:"Set the global max quota value in bytes. A value of 0 equals unlimited. The value is provided via capabilities." introductionVersion:"1.0.0"`
|
||||
DefaultQuota string `yaml:"default_quota" env:"OC_SPACES_DEFAULT_QUOTA;FRONTEND_DEFAULT_QUOTA" desc:"Set the default quota in bytes for new project spaces. A value of 0 or an invalid value means no default quota. The value is provided via capabilities and must match the default quota of the graph service." introductionVersion:"%%NEXT%%"`
|
||||
UploadMaxChunkSize int `yaml:"upload_max_chunk_size" env:"FRONTEND_UPLOAD_MAX_CHUNK_SIZE" desc:"Sets the max chunk sizes in bytes for uploads via the clients." introductionVersion:"1.0.0"`
|
||||
UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests." introductionVersion:"1.0.0"`
|
||||
DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in clients. Currently only 'tus' is available. See the developer API documentation for more details about TUS." introductionVersion:"1.0.0"`
|
||||
|
||||
@@ -82,6 +82,7 @@ func DefaultConfig() *config.Config {
|
||||
Reva: shared.DefaultRevaConfig(),
|
||||
PublicURL: "https://localhost:9200",
|
||||
UploadMaxChunkSize: 1e+7,
|
||||
DefaultQuota: "1000000000",
|
||||
UploadHTTPMethodOverride: "",
|
||||
DefaultUploadProtocol: "tus",
|
||||
DefaultLinkPermissions: 1,
|
||||
|
||||
@@ -295,11 +295,12 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
|
||||
},
|
||||
},
|
||||
"spaces": map[string]any{
|
||||
"version": "1.0.0",
|
||||
"enabled": true,
|
||||
"projects": true,
|
||||
"share_jail": true,
|
||||
"max_quota": cfg.MaxQuota,
|
||||
"version": "1.0.0",
|
||||
"enabled": true,
|
||||
"projects": true,
|
||||
"share_jail": true,
|
||||
"max_quota": cfg.MaxQuota,
|
||||
"default_quota": parseQuota(cfg.DefaultQuota),
|
||||
},
|
||||
"theme": capabilities.Default().Theme,
|
||||
"search": map[string]any{
|
||||
@@ -444,3 +445,13 @@ func passwordPolicyConfig(cfg *config.Config) (map[string]any, error) {
|
||||
"banned_passwords_list": bannedPasswordsList,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// parseQuota parses a quota in bytes the same way the graph service does.
|
||||
// Empty, invalid or negative values result in 0, which means no default quota.
|
||||
func parseQuota(quota string) uint64 {
|
||||
q, err := strconv.ParseInt(quota, 10, 64)
|
||||
if err != nil || q < 0 {
|
||||
return 0
|
||||
}
|
||||
return uint64(q)
|
||||
}
|
||||
@@ -51,7 +51,7 @@ type Config struct {
|
||||
type Spaces struct {
|
||||
WebDavBase string `yaml:"webdav_base" env:"OC_URL;GRAPH_SPACES_WEBDAV_BASE" desc:"The public facing URL of WebDAV." introductionVersion:"1.0.0"`
|
||||
WebDavPath string `yaml:"webdav_path" env:"GRAPH_SPACES_WEBDAV_PATH" desc:"The WebDAV sub-path for spaces." introductionVersion:"1.0.0"`
|
||||
DefaultQuota string `yaml:"default_quota" env:"GRAPH_SPACES_DEFAULT_QUOTA" desc:"The default quota in bytes." introductionVersion:"1.0.0"`
|
||||
DefaultQuota string `yaml:"default_quota" env:"OC_SPACES_DEFAULT_QUOTA;GRAPH_SPACES_DEFAULT_QUOTA" desc:"The default quota in bytes." introductionVersion:"1.0.0"`
|
||||
ExtendedSpacePropertiesCacheTTL int `yaml:"extended_space_properties_cache_ttl" env:"GRAPH_SPACES_EXTENDED_SPACE_PROPERTIES_CACHE_TTL" desc:"Max TTL in seconds for the spaces property cache." introductionVersion:"1.0.0"`
|
||||
UsersCacheTTL int `yaml:"users_cache_ttl" env:"GRAPH_SPACES_USERS_CACHE_TTL" desc:"Max TTL in seconds for the spaces users cache." introductionVersion:"1.0.0"`
|
||||
GroupsCacheTTL int `yaml:"groups_cache_ttl" env:"GRAPH_SPACES_GROUPS_CACHE_TTL" desc:"Max TTL in seconds for the spaces groups cache." introductionVersion:"1.0.0"`
|
||||
|
||||
Reference in new issue
Block a user