Coverage for src/gitlabracadabra/objects/application_settings.py: 72%

1#

2# Copyright (C) 2019-2022 Mathieu Parent <math.parent@gmail.com>

3#

4# This program is free software: you can redistribute it and/or modify

5# it under the terms of the GNU Lesser General Public License as published by

6# the Free Software Foundation, either version 3 of the License, or

7# (at your option) any later version.

8#

9# This program is distributed in the hope that it will be useful,

10# but WITHOUT ANY WARRANTY; without even the implied warranty of

11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

12# GNU Lesser General Public License for more details.

13#

14# You should have received a copy of the GNU Lesser General Public License

15# along with this program. If not, see <http://www.gnu.org/licenses/>.

16

17 import logging

18 from typing import ClassVar

19

20 from gitlabracadabra.objects.object import GitLabracadabraObject

21

22 logger = logging.getLogger(__name__)

23

24 SUNDAY = 0

25 MONDAY = 1

26 SATURDAY = 6

27

28

29 class GitLabracadabraApplicationSettings(GitLabracadabraObject):

30 EXAMPLE_YAML_HEADER: ClassVar[str] = "application_settings:\n type: application-settings\n"

31 DOC: ClassVar[list[str]] = [

32 "# Application settings lifecycle",

33 "gitlab_id",

34 ]

35 SCHEMA: ClassVar[dict] = {

36 "$schema": "http://json-schema.org/draft-04/schema#",

37 "title": "Application settings",

38 "type": "object",

39 "properties": {

40 # Standard properties

41 "gitlab_id": {

42 "type": "string",

43 "description": "GitLab id",

44 "_example": "gitlab",

45 "_doc_link": "action_file.md#gitlab_id",

46 },

47 # From https://docs.gitlab.com/ee/api/settings.html#list-of-settings-that-can-be-accessed-via-api-calls

48 "admin_mode": {

49 "type": "boolean",

50 "description": "Require administrators to enable Admin Mode by re-authenticating for administrative "

51 "tasks.",

52 },

53 "admin_notification_email": {

54 "type": "string",

55 "description": "Abuse reports will be sent to this address if it is set. Abuse reports are always "

56 "available in the admin area.",

57 },

58 "after_sign_out_path": {

59 "type": "string",

60 "description": "Where to redirect users after logout.",

61 },

62 "after_sign_up_text": {

63 "type": "string",

64 "description": "Text shown to the user after signing up",

65 },

66 "akismet_api_key": {

67 "type": "string",

68 "description": "API key for akismet spam protection.",

69 },

70 "akismet_enabled": {

71 "type": "boolean",

72 "description": "Enable or disable akismet spam protection.",

73 },

74 "allow_group_owners_to_manage_ldap": { # >= PREMIUM, SILVER

75 "type": "boolean",

76 "description": "Set to true to allow group owners to manage LDAP",

77 },

78 "allow_local_requests_from_hooks_and_services": {

79 "type": "boolean",

80 "description": "Allow requests to the local network from hooks and services.",

81 },

82 "archive_builds_in_human_readable": {

83 "type": "string",

84 "description": "Set the duration for which the jobs will be considered as old and expired. Once that "

85 "time passes, the jobs will be archived and no longer able to be retried. Make it empty "

86 "to never expire jobs. It has to be no less than 1 day, for example: `15 days`, `1 "

87 "month`, `2 years`.",

88 },

89 "authorized_keys_enabled": {

90 "type": "boolean",

91 "description": "By default, we write to the authorized_keys file to support Git over SSH without "

92 "additional configuration. GitLab can be optimized to authenticate SSH keys via the "

93 "database file. Only disable this if you have configured your OpenSSH server to use the "

94 "AuthorizedKeysCommand.",

95 },

96 "auto_devops_domain": {

97 "type": "string",

98 "description": "Specify a domain to use by default for every project's Auto Review Apps and Auto "

99 "Deploy stages.",

100 },

101 "auto_devops_enabled": {

102 "type": "boolean",

103 "description": "Enable Auto DevOps for projects by default. It will automatically build, test, and "

104 "deploy applications based on a predefined CI/CD configuration.",

105 },

106 "can_create_group": {

107 "type": "boolean",

108 "description": "Indicates whether users can create top-level groups. Introduced in GitLab 15.5. "

109 "Defaults to true.",

110 },

111 "check_namespace_plan": { # >= PREMIUM, SILVER

112 "type": "boolean",

113 "description": "Enabling this will make only licensed EE features available to projects if the project "

114 "namespace's plan includes the feature or if the project is public.",

115 },

116 "commit_email_hostname": {

117 "type": "string",

118 "description": " Custom hostname (for private commit emails).",

119 },

120 "container_registry_token_expire_delay": {

121 "type": "integer",

122 "description": "Container Registry token duration in minutes.",

123 },

124 "default_artifacts_expire_in": {

125 "type": "string",

126 "description": "Set the default expiration time for each job's artifacts.",

127 },

128 "default_branch_protection": {

129 "type": "integer",

130 "description": "Determine if developers can push to default branch. Can take: 0 (not protected, both "

131 "developers and maintainers can push new commits, force push, or delete the branch), 1 "

132 "(partially protected, developers and maintainers can push new commits, but cannot "

133 "force push or delete the branch) or 2 (fully protected, developers cannot push new "

134 "commits, but maintainers can; no-one can force push or delete the branch) as a "

135 "parameter. Default is 2.",

136 "enum": [0, 1, 2, 3],

137 },

138 "default_ci_config_path": {

139 "type": "string",

140 "description": "Default CI configuration path for new projects",

141 },

142 "default_group_visibility": {

143 "type": "string",

144 "description": "What visibility level new groups receive. Can take private, internal and public as a "

145 "parameter. Default is private.",

146 "enum": ["private", "internal", "public"],

147 },

148 "default_project_creation": {

149 "type": "integer",

150 "description": "Default project creation protection. Can take: `0` _(No one)_, `1` _(Maintainers)_ or "

151 "`2` _(Developers + Maintainers)_",

152 "enum": [0, 1, 2],

153 },

154 "default_project_visibility": {

155 "type": "string",

156 "description": "What visibility level new projects receive. Can take `private`, `internal` and "

157 "`public` as a parameter.",

158 "enum": ["private", "internal", "public"],

159 },

160 "default_projects_limit": {

161 "type": "integer",

162 "description": "Project limit per user.",

163 },

164 "default_snippet_visibility": {

165 "type": "string",

166 "description": "What visibility level new snippets receive. Can take private, internal and public as a "

167 "parameter. Default is private.",

168 "enum": ["private", "internal", "public"],

169 },

170 "diff_max_patch_bytes": {

171 "type": "integer",

172 "description": "Maximum diff patch size (Bytes).",

173 },

174 "disabled_oauth_sign_in_sources": {

175 "type": "array",

176 "description": "Disabled OAuth sign-in sources.",

177 "items": {

178 "type": "string",

179 },

180 "uniqueItems": True,

181 },

182 "dns_rebinding_protection_enabled": {

183 "type": "boolean",

184 "description": "Enforce DNS rebinding attack protection.",

185 },

186 "domain_blacklist": {

187 "type": "array",

188 "description": "Users with e-mail addresses that match these domain(s) will NOT be able to sign-up. "

189 "Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, "

190 "*.domain.com.",

191 "items": {

192 "type": "string",

193 },

194 "uniqueItems": True,

195 },

196 "domain_blacklist_enabled": {

197 "type": "boolean",

198 "description": "Allows blocking sign-ups from emails from specific domains.",

199 },

200 "domain_whitelist": {

201 "type": "array",

202 "description": "Force people to use only corporate emails for sign-up. Default is null, meaning there "

203 "is no restriction.",

204 "items": {

205 "type": "string",

206 },

207 "uniqueItems": True,

208 },

209 "dsa_key_restriction": {

210 "type": "integer",

211 "description": "The minimum allowed bit length of an uploaded DSA key. Default is 0 (no restriction). "

212 "-1 disables DSA keys.",

213 },

214 "ecdsa_key_restriction": {

215 "type": "integer",

216 "description": "The minimum allowed curve size (in bits) of an uploaded ECDSA key. Default is 0 (no "

217 "restriction). -1 disables ECDSA keys.",

218 },

219 "ed25519_key_restriction": {

220 "type": "integer",

221 "description": "The minimum allowed curve size (in bits) of an uploaded ED25519 key. Default is 0 (no "

222 "restriction). -1 disables ED25519 keys.",

223 },

224 "elasticsearch_aws": { # >= PREMIUM, SILVER

225 "type": "boolean",

226 "description": "Enable the use of AWS hosted Elasticsearch",

227 },

228 "elasticsearch_aws_access_key": { # >= PREMIUM, SILVER

229 "type": "string",

230 "description": "AWS IAM access key",

231 },

232 "elasticsearch_aws_region": { # >= PREMIUM, SILVER

233 "type": "string",

234 "description": "The AWS region the elasticsearch domain is configured",

235 },

236 "elasticsearch_aws_secret_access_key": { # >= PREMIUM, SILVER

237 "type": "string",

238 "description": "AWS IAM secret access key",

239 },

240 "elasticsearch_experimental_indexer": { # >= PREMIUM, SILVER

241 "type": "boolean",

242 "description": "Use the experimental elasticsearch indexer. More info: "

243 "https://gitlab.com/gitlab-org/gitlab-elasticsearch-indexer ",

244 },

245 "elasticsearch_indexing": { # >= PREMIUM, SILVER

246 "type": "boolean",

247 "description": "Enable Elasticsearch indexing",

248 },

249 "elasticsearch_search": { # >= PREMIUM, SILVER

250 "type": "boolean",

251 "description": "Enable Elasticsearch search",

252 },

253 "elasticsearch_url": { # >= PREMIUM, SILVER

254 "type": "string",

255 "description": "The url to use for connecting to Elasticsearch. Use a comma-separated list to support "

256 "cluster (e.g., http://localhost:9200, http://localhost:9201). If your Elasticsearch "

257 "instance is password protected, pass the username:password in the URL (e.g., "

258 "http://<username>:<password>@<elastic_host>:9200/).",

259 },

260 "elasticsearch_limit_indexing": { # >= PREMIUM, SILVER

261 "type": "boolean",

262 "description": "Limit Elasticsearch to index certain namespaces and projects",

263 },

264 "elasticsearch_project_ids": { # >= PREMIUM, SILVER

265 "type": "array",

266 "description": "The projects to index via Elasticsearch if elasticsearch_limit_indexing is enabled.",

267 "items": {

268 "type": "integer",

269 },

270 "uniqueItems": True,

271 },

272 "elasticsearch_namespace_ids": { # >= PREMIUM, SILVER

273 "type": "array",

274 "description": "The namespaces to index via Elasticsearch if elasticsearch_limit_indexing is enabled.",

275 "items": {

276 "type": "integer",

277 },

278 "uniqueItems": True,

279 },

280 "email_additional_text": { # >= PREMIUM, SILVER

281 "type": "string",

282 "description": "Additional text added to the bottom of every email for legal/auditing/compliance "

283 "reasons",

284 },

285 "email_author_in_body": {

286 "type": "boolean",

287 "description": "Some email servers do not support overriding the email sender name. Enable this option "

288 "to include the name of the author of the issue, merge request or comment in the email "

289 "body instead.",

290 },

291 "enabled_git_access_protocol": {

292 "type": "string",

293 "description": "Enabled protocols for Git access. Allowed values are: ssh, http, and nil to allow both "

294 "protocols.",

295 "enum": ["ssh", "http", "both"],

296 },

297 "enforce_terms": {

298 "type": "boolean",

299 "description": "Enforce application ToS to all users.",

300 },

301 "external_auth_client_cert": {

302 "type": "string",

303 "description": "The certificate to use to authenticate with the external authorization service",

304 },

305 "external_auth_client_key": {

306 "type": "string",

307 "description": "Private key for the certificate when authentication is required for the external "

308 "authorization service, this is encrypted when stored",

309 },

310 "external_auth_client_key_pass": {

311 "type": "string",

312 "description": "Passphrase to use for the private key when authenticating with the external service "

313 "this is encrypted when stored",

314 },

315 "external_authorization_service_default_label": {

316 "type": "string",

317 "description": "The default classification label to use when requesting authorization and no "

318 "classification label has been specified on the project",

319 },

320 "external_authorization_service_enabled": {

321 "type": "boolean",

322 "description": "Enable using an external authorization service for accessing projects",

323 },

324 "external_authorization_service_timeout": {

325 "type": "number",

326 "description": "The timeout after which an authorization request is aborted, in seconds. When a "

327 "request times out, access is denied to the user. (min: 0.001, max: 10, step: 0.001)",

328 },

329 "external_authorization_service_url": {

330 "type": "string",

331 "description": "URL to which authorization requests will be directed",

332 },

333 "file_template_project_id": { # >= PREMIUM, SILVER

334 "type": "integer",

335 "description": "The ID of a project to load custom file templates from",

336 },

337 "first_day_of_week": {

338 "type": "string",

339 "description": "Start day of the week for calendar views and date pickers.",

340 "enum": ["sunday", "monday", "saturday"],

341 },

342 "geo_node_allowed_ips": { # PREMIUM, SILVER

343 "type": "string",

344 "description": "Comma-separated list of IPs and CIDRs of allowed secondary nodes. For example, "

345 "1.1.1.1, 2.2.2.0/24.",

346 },

347 "geo_status_timeout": { # >= PREMIUM, SILVER

348 "type": "integer",

349 "description": "The amount of seconds after which a request to get a secondary node status will time "

350 "out.",

351 },

352 "gitaly_timeout_default": {

353 "type": "integer",

354 "description": "Default Gitaly timeout, in seconds. This timeout is not enforced for git fetch/push "

355 "operations or Sidekiq jobs. Set to 0 to disable timeouts.",

356 },

357 "gitaly_timeout_fast": {

358 "type": "integer",

359 "description": "Gitaly fast operation timeout, in seconds. Some Gitaly operations are expected to be "

360 "fast. If they exceed this threshold, there may be a problem with a storage shard and "

361 "'failing fast' can help maintain the stability of the GitLab instance. Set to 0 to "

362 "disable timeouts.",

363 },

364 "gitaly_timeout_medium": {

365 "type": "integer",

366 "description": "Medium Gitaly timeout, in seconds. This should be a value between the Fast and the "

367 "Default timeout. Set to 0 to disable timeouts.",

368 },

369 "grafana_enabled": {

370 "type": "boolean",

371 "description": "Enable Grafana.",

372 },

373 "grafana_url": {

374 "type": "string",

375 "description": "Grafana URL.",

376 },

377 "gravatar_enabled": {

378 "type": "boolean",

379 "description": "Enable Gravatar.",

380 },

381 "hashed_storage_enabled": {

382 "type": "boolean",

383 "description": "Create new projects using hashed storage paths: Enable immutable, hash-based paths and "

384 "repository names to store repositories on disk. This prevents repositories from having "

385 "to be moved or renamed when the Project URL changes and may improve disk I/O "

386 "performance. (EXPERIMENTAL)",

387 },

388 "help_page_hide_commercial_content": {

389 "type": "boolean",

390 "description": "Hide marketing-related entries from help.",

391 },

392 "help_page_support_url": {

393 "type": "string",

394 "description": "Alternate support URL for help page.",

395 },

396 "help_page_text": {

397 "type": "string",

398 "description": "Custom text displayed on the help page.",

399 },

400 "help_text": { # >= PREMIUM, SILVER

401 "type": "string",

402 "description": "GitLab server administrator information",

403 },

404 "hide_third_party_offers": {

405 "type": "boolean",

406 "description": "Do not display offers from third parties within GitLab.",

407 },

408 "home_page_url": {

409 "type": "string",

410 "description": "Redirect to this URL when not logged in.",

411 },

412 "housekeeping_enabled": {

413 "type": "boolean",

414 "description": "Enable or disable git housekeeping.",

415 },

416 "housekeeping_full_repack_period": {

417 "type": "integer",

418 "description": "Number of Git pushes after which an incremental git repack is run.",

419 },

420 "housekeeping_gc_period": {

421 "type": "integer",

422 "description": "Number of Git pushes after which git gc is run.",

423 },

424 "housekeeping_incremental_repack_period": {

425 "type": "integer",

426 "description": "Number of Git pushes after which an incremental git repack is run.",

427 },

428 "html_emails_enabled": {

429 "type": "boolean",

430 "description": "Enable HTML emails.",

431 },

432 "import_sources": {

433 "type": "array",

434 "description": "Sources to allow project import from, possible values.",

435 "items": {

436 "type": "string",

437 "enum": [

438 "github",

439 "bitbucket",

440 "bitbucket_server",

441 "gitlab",

442 "google_code",

443 "fogbugz",

444 "git",

445 "gitlab_project",

446 "gitea",

447 "manifest",

448 "phabricator",

449 ],

450 },

451 "uniqueItems": True,

452 },

453 "instance_statistics_visibility_private": {

454 "type": "boolean",

455 "description": "When set to true Instance statistics will only be available to admins.",

456 },

457 "local_markdown_version": {

458 "type": "integer",

459 "description": "Increase this value when any cached markdown should be invalidated.",

460 },

461 "max_artifacts_size": {

462 "type": "integer",

463 "description": "Maximum artifacts size in MB",

464 },

465 "max_attachment_size": {

466 "type": "integer",

467 "description": "Limit attachment size in MB",

468 },

469 "max_pages_size": {

470 "type": "integer",

471 "description": "Maximum size of pages repositories in MB",

472 },

473 "metrics_enabled": {

474 "type": "boolean",

475 "description": "Enable influxDB metrics.",

476 },

477 "metrics_host": {

478 "type": "string",

479 "description": "InfluxDB host.",

480 },

481 "metrics_method_call_threshold": {

482 "type": "integer",

483 "description": "A method call is only tracked when it takes longer than the given amount of "

484 "milliseconds.",

485 },

486 "metrics_packet_size": {

487 "type": "integer",

488 "description": "The amount of datapoints to send in a single UDP packet.",

489 },

490 "metrics_pool_size": {

491 "type": "integer",

492 "description": "The amount of InfluxDB connections to keep open.",

493 },

494 "metrics_port": {

495 "type": "integer",

496 "description": "The UDP port to use for connecting to InfluxDB.",

497 },

498 "metrics_sample_interval": {

499 "type": "integer",

500 "description": "The sampling interval in seconds.",

501 },

502 "metrics_timeout": {

503 "type": "integer",

504 "description": "The amount of seconds after which InfluxDB will time out.",

505 },

506 "mirror_available": {

507 "type": "boolean",

508 "description": "Allow mirrors to be set up for projects. If disabled, only admins will be able to set "

509 "up mirrors in projects.",

510 },

511 "mirror_capacity_threshold": { # >= PREMIUM, SILVER

512 "type": "integer",

513 "description": "Minimum capacity to be available before scheduling more mirrors preemptively",

514 },

515 "mirror_max_capacity": { # >= PREMIUM, SILVER

516 "type": "integer",

517 "description": "Maximum number of mirrors that can be synchronizing at the same time.",

518 },

519 "mirror_max_delay": { # >= PREMIUM, SILVER

520 "type": "integer",

521 "description": "Maximum time (in minutes) between updates that a mirror can have when scheduled to "

522 "synchronize.",

523 },

524 "pages_domain_verification_enabled": {

525 "type": "boolean",

526 "description": "Require users to prove ownership of custom domains. Domain verification is an "

527 "essential security measure for public GitLab sites. Users are required to demonstrate "

528 "they control a domain before it is enabled.",

529 },

530 "password_authentication_enabled_for_git": {

531 "type": "boolean",

532 "description": "Enable authentication for Git over HTTP(S) via a GitLab account password. Default is "

533 "true.",

534 },

535 "password_authentication_enabled_for_web": {

536 "type": "boolean",

537 "description": "Enable authentication for the web interface via a GitLab account password. Default is "

538 "true.",

539 },

540 "performance_bar_allowed_group_path": {

541 "type": "string",

542 "description": "Path of the group that is allowed to toggle the performance bar.",

543 },

544 "plantuml_enabled": {

545 "type": "boolean",

546 "description": "Enable PlantUML integration.",

547 },

548 "plantuml_url": {

549 "type": "string",

550 "description": "The PlantUML instance URL for integration.",

551 },

552 "polling_interval_multiplier": {

553 "type": "number",

554 "description": "Interval multiplier used by endpoints that perform polling. Set to 0 to disable "

555 "polling.",

556 },

557 "project_export_enabled": {

558 "type": "boolean",

559 "description": "Enable project export.",

560 },

561 "prometheus_metrics_enabled": {

562 "type": "boolean",

563 "description": "Enable prometheus metrics.",

564 },

565 "protected_ci_variables": {

566 "type": "boolean",

567 "description": "Environment variables are protected by default.",

568 },

569 "pseudonymizer_enabled": { # >= PREMIUM, SILVER

570 "type": "boolean",

571 "description": "When enabled, GitLab will run a background job that will produce pseudonymized CSVs of "

572 "the GitLab database that will be uploaded to your configured object storage directory.",

573 },

574 "recaptcha_enabled": {

575 "type": "boolean",

576 "description": "Enable recaptcha.",

577 },

578 "recaptcha_private_key": {

579 "type": "string",

580 "description": "Private key for recaptcha.",

581 },

582 "recaptcha_site_key": {

583 "type": "string",

584 "description": "Site key for recaptcha.",

585 },

586 "receive_max_input_size": {

587 "type": "integer",

588 "description": "Maximum push size (MB).",

589 },

590 "repository_checks_enabled": {

591 "type": "boolean",

592 "description": "GitLab will periodically run git fsck in all project and wiki repositories to look for "

593 "silent disk corruption issues.",

594 },

595 "repository_size_limit": { # >= PREMIUM, SILVER

596 "type": "integer",

597 "description": "Size limit per repository (MB)",

598 },

599 "repository_storages": {

600 "type": "array",

601 "description": "A list of names of enabled storage paths, taken from gitlab.yml. New projects will be "

602 "created in one of these stores, chosen at random.",

603 "items": {

604 "type": "string",

605 },

606 "uniqueItems": True,

607 },

608 "require_two_factor_authentication": {

609 "type": "boolean",

610 "description": "Require all users to set up Two-factor authentication.",

611 },

612 "restricted_visibility_levels": {

613 "type": "array",

614 "description": "Selected levels cannot be used by non-admin users for groups, projects or snippets. "

615 "Can take private, internal and public as a parameter. Default is null which means "

616 "there is no restriction.",

617 "items": {

618 "type": "string",

619 "enum": ["private", "internal", "public"],

620 },

621 "uniqueItems": True,

622 },

623 "rsa_key_restriction": {

624 "type": "integer",

625 "description": "The minimum allowed bit length of an uploaded RSA key. Default is 0 (no restriction). "

626 "-1 disables RSA keys.",

627 },

628 "send_user_confirmation_email": {

629 "type": "boolean",

630 "description": "Send confirmation email on sign-up.",

631 },

632 "session_expire_delay": {

633 "type": "integer",

634 "description": "Session duration in minutes. GitLab restart is required to apply changes",

635 },

636 "shared_runners_enabled": {

637 "type": "boolean",

638 "description": "Enable shared runners for new projects.",

639 },

640 "shared_runners_minutes": { # PREMIUM, SILVER

641 "type": "integer",

642 "description": "Set the maximum number of pipeline minutes that a group can use on shared Runners per "

643 "month.",

644 },

645 "shared_runners_text": {

646 "type": "string",

647 "description": "Shared runners text.",

648 },

649 "sign_in_text": {

650 "type": "string",

651 "description": "Text on the login page.",

652 },

653 "signup_enabled": {

654 "type": "boolean",

655 "description": "Enable registration.",

656 },

657 "slack_app_enabled": { # PREMIUM, SILVER

658 "type": "boolean",

659 "description": " Enable Slack app.",

660 },

661 "slack_app_id": { # PREMIUM, SILVER

662 "type": "string",

663 "description": "The app id of the Slack-app.",

664 },

665 "slack_app_secret": { # PREMIUM, SILVER

666 "type": "string",

667 "description": "The app secret of the Slack-app.",

668 },

669 "slack_app_verification_token": { # PREMIUM, SILVER

670 "type": "string",

671 "description": "The verification token of the Slack-app.",

672 },

673 "terminal_max_session_time": {

674 "type": "integer",

675 "description": "Maximum time for web terminal websocket connection (in seconds). Set to 0 for "

676 "unlimited time.",

677 },

678 "terms": {

679 "type": "string",

680 "description": "Markdown content for the ToS.",

681 },

682 "throttle_authenticated_api_enabled": {

683 "type": "boolean",

684 "description": "Enable authenticated API request rate limit. Helps reduce request volume (e.g. from "

685 "crawlers or abusive bots).",

686 },

687 "throttle_authenticated_api_period_in_seconds": {

688 "type": "integer",

689 "description": "Rate limit period in seconds.",

690 },

691 "throttle_authenticated_api_requests_per_period": {

692 "type": "integer",

693 "description": "Max requests per period per user.",

694 },

695 "throttle_authenticated_web_enabled": {

696 "type": "boolean",

697 "description": "Enable authenticated web request rate limit. Helps reduce request volume (e.g. from "

698 "crawlers or abusive bots).",

699 },

700 "throttle_authenticated_web_period_in_seconds": {

701 "type": "integer",

702 "description": "Rate limit period in seconds.",

703 },

704 "throttle_authenticated_web_requests_per_period": {

705 "type": "integer",

706 "description": "Max requests per period per user.",

707 },

708 "throttle_unauthenticated_enabled": {

709 "type": "boolean",

710 "description": "Enable unauthenticated request rate limit. Helps reduce request volume (e.g. from "

711 "crawlers or abusive bots).",

712 },

713 "throttle_unauthenticated_period_in_seconds": {

714 "type": "integer",

715 "description": "Rate limit period in seconds.",

716 },

717 "throttle_unauthenticated_requests_per_period": {

718 "type": "integer",

719 "description": "Max requests per period per IP.",

720 },

721 "time_tracking_limit_to_hours": {

722 "type": "boolean",

723 "description": "Limit display of time tracking units to hours. Default is false.",

724 },

725 "two_factor_grace_period": {

726 "type": "integer",

727 "description": "Amount of time (in hours) that users are allowed to skip forced configuration of "

728 "two-factor authentication.",

729 },

730 "unique_ips_limit_enabled": {

731 "type": "boolean",

732 "description": "Limit sign in from multiple ips.",

733 },

734 "unique_ips_limit_per_user": {

735 "type": "integer",

736 "description": "Maximum number of ips per user.",

737 },

738 "unique_ips_limit_time_window": {

739 "type": "integer",

740 "description": "How many seconds an IP will be counted towards the limit.",

741 },

742 "usage_ping_enabled": {

743 "type": "boolean",

744 "description": "Every week GitLab will report license usage back to GitLab, Inc.",

745 },

746 "user_default_external": {

747 "type": "boolean",

748 "description": "Newly registered users will be external by default.",

749 },

750 "user_default_internal_regex": {

751 "type": "string",

752 "description": "Specify an e-mail address regex pattern to identify default internal users.",

753 },

754 "user_oauth_applications": {

755 "type": "boolean",

756 "description": "Allow users to register any application to use GitLab as an OAuth provider.",

757 },

758 "user_show_add_ssh_key_message": {

759 "type": "boolean",

760 "description": 'When set to false disable the "You won\'t be able to pull or push project code via SSH" '

761 "warning shown to users with no uploaded SSH key.",

762 },

763 "version_check_enabled": {

764 "type": "boolean",

765 "description": "Let GitLab inform you when an update is available.",

766 },

767 "web_ide_clientside_preview_enabled": {

768 "type": "boolean",

769 "description": "Client side evaluation (Allow live previews of JavaScript projects in the Web IDE "

770 "using CodeSandbox client side evaluation).",

771 },

772 },

773 "additionalProperties": False,

774 "dependencies": {

775 "akismet_enabled": ["akismet_api_key"],

776 "domain_blacklist_enabled": ["domain_blacklist"],

777 "elasticsearch_aws": ["elasticsearch_aws_region"],

778 "elasticsearch_indexing": ["elasticsearch_url"],

779 "enforce_terms": ["terms"],

780 "external_auth_client_cert": ["external_auth_client_key"],

781 "external_authorization_service_enabled": [

782 "external_authorization_service_timeout",

783 "external_authorization_service_url",

784 ],

785 "housekeeping_enabled": [

786 "housekeeping_full_repack_period",

787 "housekeeping_gc_period",

788 "housekeeping_incremental_repack_period",

789 ],

790 "metrics_enabled": [

791 "metrics_host",

792 "metrics_method_call_threshold",

793 "metrics_packet_size",

794 "metrics_pool_size",

795 "metrics_port",

796 "metrics_sample_interval",

797 "metrics_timeout",

798 ],

799 "plantuml_enabled": ["plantuml_url"],

800 "recaptcha_enabled": ["recaptcha_site_key", "recaptcha_private_key"],

801 "require_two_factor_authentication": ["two_factor_grace_period"],

802 "shared_runners_enabled": ["shared_runners_text"],

803 },

804 }

805

806 """"_object_manager()

807

808 Return the python-gitlab Gilab object.

809 """

810

811 def _object_manager(self):

812 return self.pygitlab.settings

813

814 """"_get()

815

816 Set the _object attribute

817 """

818

819 def _get(self):

820 obj_manager = self._object_manager()

821 self._obj = obj_manager.get()

822

823 """"mangle_param()

824

825 Convert a param value from GitLabracadabra form to API form.

826 """

827

828 def mangle_param(self, param_name, param_value):

829 if param_name == "first_day_of_week":

830 if param_value == "sunday": 830 ↛ 831line 830 didn't jump to line 831 because the condition on line 830 was never true

831 return SUNDAY

832 if param_value == "monday": 832 ↛ 834line 832 didn't jump to line 834 because the condition on line 832 was always true

833 return MONDAY

834 if param_value == "saturday":

835 return SATURDAY

836 # https://github.com/python-gitlab/python-gitlab/blob/8753add72061ea01c508a42d16a27388b1d92677/gitlab/v4/objects/settings.py#L80-L87

837 if param_name in [

838 "asset_proxy_allowlist",

839 "disabled_oauth_sign_in_sources",

840 "domain_allowlist",

841 "domain_denylist",

842 "import_sources",

843 "restricted_visibility_levels",

844 ]:

845 return ",".join([str(x) for x in param_value])

846 return GitLabracadabraObject.mangle_param(self, param_name, param_value)

847

848 """"unmangle_param()

849

850 Convert a param value from API form to GitLabracadabra form.

851 """

852

853 def unmangle_param(self, param_name, param_value):

854 if param_name == "first_day_of_week":

855 if param_value == SUNDAY: 855 ↛ 857line 855 didn't jump to line 857 because the condition on line 855 was always true

856 return "sunday"

857 if param_value == MONDAY:

858 return "monday"

859 if param_value == SATURDAY:

860 return "saturday"

861 return GitLabracadabraObject.unmangle_param(self, param_name, param_value)