Make amount of users in patch configurable.

This PR changes the following:

* Create an API config section for API configurables.
* Add a setting `UserPatchLimit` that controls how many users can be changed in a PATCH request.
* Use this setting in the API to limit the amount of users that can be changed.
This commit is contained in:
Daniël Franke
2023-01-10 11:45:24 +01:00
committed by Ralf Haferkamp
parent 883d068b48
commit 49d71ea111
3 changed files with 13 additions and 4 deletions
+7
View File
@@ -19,6 +19,8 @@ type Config struct {
HTTP HTTP `yaml:"http"`
API API `yaml:"api"`
Reva *shared.Reva `yaml:"reva"`
TokenManager *TokenManager `yaml:"token_manager"`
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
@@ -85,6 +87,11 @@ type Identity struct {
LDAP LDAP `yaml:"ldap"`
}
// API represents API configuration parameters.
type API struct {
UserPatchLimit int `yaml:"user_patch_limit" env:"GRAPH_USER_PATCH_LIMIT" desc:"The amount of users allowed to be changed in PATCH requests."`
}
// Events combines the configuration options for the event bus.
type Events struct {
Endpoint string `yaml:"endpoint" env:"GRAPH_EVENTS_ENDPOINT" desc:"The address of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture. Set to a empty string to disable emitting events."`
@@ -30,6 +30,9 @@ func DefaultConfig() *config.Config {
Service: config.Service{
Name: "graph",
},
API: config.API{
UserPatchLimit: 20,
},
Reva: shared.DefaultRevaConfig(),
Spaces: config.Spaces{
WebDavBase: "https://localhost:9200",