Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\Service\Policy\Contract; |
| 10 | |
| 11 | use OCA\Libresign\Service\Policy\Model\PolicyContext; |
| 12 | use OCA\Libresign\Service\Policy\Model\PolicyLayer; |
| 13 | |
| 14 | interface IPolicySource { |
| 15 | public function loadSystemPolicy(string $policyKey): ?PolicyLayer; |
| 16 | |
| 17 | /** @return list<PolicyLayer> */ |
| 18 | public function loadGroupPolicies(string $policyKey, PolicyContext $context): array; |
| 19 | |
| 20 | /** @return list<PolicyLayer> */ |
| 21 | public function loadCirclePolicies(string $policyKey, PolicyContext $context): array; |
| 22 | |
| 23 | public function loadUserPolicy(string $policyKey, PolicyContext $context): ?PolicyLayer; |
| 24 | |
| 25 | public function loadUserPreference(string $policyKey, PolicyContext $context): ?PolicyLayer; |
| 26 | |
| 27 | /** |
| 28 | * Bulk-load group policy layers for all known policy keys at once. |
| 29 | * |
| 30 | * @param list<string> $policyKeys |
| 31 | * @return array<string, list<PolicyLayer>> keyed by policyKey |
| 32 | */ |
| 33 | public function loadAllGroupPolicies(array $policyKeys, PolicyContext $context): array; |
| 34 | |
| 35 | /** |
| 36 | * Bulk-load user preference layers for all known policy keys at once. |
| 37 | * |
| 38 | * @param list<string> $policyKeys |
| 39 | * @return array<string, PolicyLayer> keyed by policyKey |
| 40 | */ |
| 41 | public function loadAllUserPolicies(array $policyKeys, PolicyContext $context): array; |
| 42 | |
| 43 | /** |
| 44 | * Bulk-load user preference layers for all known policy keys at once. |
| 45 | * |
| 46 | * @param list<string> $policyKeys |
| 47 | * @return array<string, PolicyLayer> keyed by policyKey |
| 48 | */ |
| 49 | public function loadAllUserPreferences(array $policyKeys, PolicyContext $context): array; |
| 50 | |
| 51 | public function loadRequestOverride(string $policyKey, PolicyContext $context): ?PolicyLayer; |
| 52 | |
| 53 | public function loadGroupPolicyConfig(string $policyKey, string $groupId): ?PolicyLayer; |
| 54 | |
| 55 | /** |
| 56 | * @return list<array{targetId: string, policy: PolicyLayer}> |
| 57 | */ |
| 58 | public function listGroupPoliciesByKey(string $policyKey): array; |
| 59 | |
| 60 | /** |
| 61 | * @param list<string> $groupIds |
| 62 | * @return list<array{targetId: string, policy: PolicyLayer}> |
| 63 | */ |
| 64 | public function listGroupPoliciesByKeyForTargets(string $policyKey, array $groupIds): array; |
| 65 | |
| 66 | public function saveSystemPolicy(string $policyKey, mixed $value, bool $allowChildOverride = false): void; |
| 67 | |
| 68 | public function clearSystemPolicy(string $policyKey): void; |
| 69 | |
| 70 | public function saveGroupPolicy(string $policyKey, string $groupId, mixed $value, bool $allowChildOverride, bool $createdBySystemAdmin = false, ?PolicyContext $context = null): void; |
| 71 | |
| 72 | public function clearGroupPolicy(string $policyKey, string $groupId, bool $preserveSystemCreatedBase = false): void; |
| 73 | |
| 74 | public function loadUserPolicyConfig(string $policyKey, string $userId): ?PolicyLayer; |
| 75 | |
| 76 | /** |
| 77 | * @return list<array{targetId: string, policy: PolicyLayer}> |
| 78 | */ |
| 79 | public function listUserPoliciesByKey(string $policyKey): array; |
| 80 | |
| 81 | public function saveUserPolicy(string $policyKey, PolicyContext $context, mixed $value, bool $allowChildOverride): void; |
| 82 | |
| 83 | public function clearUserPolicy(string $policyKey, PolicyContext $context): void; |
| 84 | |
| 85 | public function saveUserPreference(string $policyKey, PolicyContext $context, mixed $value): void; |
| 86 | |
| 87 | public function clearUserPreference(string $policyKey, PolicyContext $context): void; |
| 88 | } |