1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
from typing import Any, cast, Dict, Optional, Union
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
__all__ = [
"ApplicationSettings",
"ApplicationSettingsManager",
]
class ApplicationSettings(SaveMixin, RESTObject):
_id_attr = None
class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
_path = "/application/settings"
_obj_cls = ApplicationSettings
_update_attrs = RequiredOptional(
optional=(
"id",
"default_projects_limit",
"signup_enabled",
"password_authentication_enabled_for_web",
"gravatar_enabled",
"sign_in_text",
"created_at",
"updated_at",
"home_page_url",
"default_branch_protection",
"restricted_visibility_levels",
"max_attachment_size",
"session_expire_delay",
"default_project_visibility",
"default_snippet_visibility",
"default_group_visibility",
"outbound_local_requests_whitelist",
"disabled_oauth_sign_in_sources",
"domain_whitelist",
"domain_blacklist_enabled",
"domain_blacklist",
"domain_allowlist",
"domain_denylist_enabled",
"domain_denylist",
"external_authorization_service_enabled",
"external_authorization_service_url",
"external_authorization_service_default_label",
"external_authorization_service_timeout",
"import_sources",
"user_oauth_applications",
"after_sign_out_path",
"container_registry_token_expire_delay",
"repository_storages",
"plantuml_enabled",
"plantuml_url",
"terminal_max_session_time",
"polling_interval_multiplier",
"rsa_key_restriction",
"dsa_key_restriction",
"ecdsa_key_restriction",
"ed25519_key_restriction",
"first_day_of_week",
"enforce_terms",
"terms",
"performance_bar_allowed_group_id",
"instance_statistics_visibility_private",
"user_show_add_ssh_key_message",
"file_template_project_id",
"local_markdown_version",
"asset_proxy_enabled",
"asset_proxy_url",
"asset_proxy_whitelist",
"asset_proxy_allowlist",
"geo_node_allowed_ips",
"allow_local_requests_from_hooks_and_services",
"allow_local_requests_from_web_hooks_and_services",
"allow_local_requests_from_system_hooks",
),
)
_types = {
"asset_proxy_allowlist": types.ListAttribute,
"disabled_oauth_sign_in_sources": types.ListAttribute,
"domain_allowlist": types.ListAttribute,
"domain_denylist": types.ListAttribute,
"import_sources": types.ListAttribute,
"restricted_visibility_levels": types.ListAttribute,
}
@exc.on_http_error(exc.GitlabUpdateError)
def update(
self,
id: Optional[Union[str, int]] = None,
new_data: Dict[str, Any] = None,
**kwargs: Any
) -> Dict[str, Any]:
"""Update an object on the server.
Args:
id: ID of the object to update (can be None if not required)
new_data: the update data for the object
**kwargs: Extra options to send to the server (e.g. sudo)
Returns:
The new object data (*not* a RESTObject)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabUpdateError: If the server cannot perform the request
"""
new_data = new_data or {}
data = new_data.copy()
if "domain_whitelist" in data and data["domain_whitelist"] is None:
data.pop("domain_whitelist")
return super(ApplicationSettingsManager, self).update(id, data, **kwargs)
def get(
self, id: Optional[Union[int, str]] = None, **kwargs: Any
) -> Optional[ApplicationSettings]:
return cast(ApplicationSettings, super().get(id=id, **kwargs))
|