aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Service/ConfigService.php
blob: 9e7826fe580b744d47987087e6df74607f200b72 (plain)
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
<?php

declare(strict_types=1);

namespace OCA\Files_Trashbin\Service;

use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\Server;

/**
 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
class ConfigService {
	public static function getDeleteFromTrashEnabled(): bool {
		return Server::get(IConfig::class)->getSystemValueBool('files.trash.delete', true);
	}

	public static function injectInitialState(IInitialState $initialState): void {
		$initialState->provideLazyInitialState('config', function () {
			return [
				'allow_delete' => ConfigService::getDeleteFromTrashEnabled(),
			];
		});
	}
}