mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-12-11 05:51:57 +01:00
3b70949651
This adds a new configuration setting: `[quota.default].TOTAL`, which will be used if no groups are configured for a particular user. The new option makes it possible to entirely skip configuring quotas via the API if all that one wants is a total size. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
25 lines
513 B
Go
25 lines
513 B
Go
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package quota
|
|
|
|
import (
|
|
"code.gitea.io/gitea/modules/setting"
|
|
)
|
|
|
|
func EvaluateDefault(used Used, forSubject LimitSubject) bool {
|
|
groups := GroupList{
|
|
&Group{
|
|
Name: "builtin-default-group",
|
|
Rules: []Rule{
|
|
{
|
|
Name: "builtin-default-rule",
|
|
Limit: setting.Quota.Default.Total,
|
|
Subjects: LimitSubjects{LimitSubjectSizeAll},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
return groups.Evaluate(used, forSubject)
|
|
}
|