|
33 | 33 | use OCP\EventDispatcher\Event; |
34 | 34 | use OCP\EventDispatcher\IEventDispatcher; |
35 | 35 | use OCP\EventDispatcher\IEventListener; |
| 36 | +use OCP\IConfig; |
36 | 37 | use OCP\IDBConnection; |
37 | 38 | use OCP\IL10N; |
38 | 39 | use OCP\Interaction\Actions\ShareAction; |
|
41 | 42 | use OCP\IUserManager; |
42 | 43 | use OCP\L10N\IFactory; |
43 | 44 | use OCP\Security\ISecureRandom; |
| 45 | +use OCP\Share\IManager; |
44 | 46 | use OCP\Snowflake\ISnowflakeGenerator; |
45 | 47 | use OCP\User\Events\BeforeUserDeletedEvent; |
46 | 48 | use Psr\Clock\ClockInterface; |
@@ -71,6 +73,8 @@ public function __construct( |
71 | 73 | private ISharingRegistry $registry, |
72 | 74 | private ISharingBackend $backend, |
73 | 75 | private ClockInterface $clock, |
| 76 | + private IManager $legacySharingManager, |
| 77 | + private IConfig $config, |
74 | 78 | ) { |
75 | 79 | $this->randomizer = new Randomizer(); |
76 | 80 | $this->l10n = $l10nFactory->get('sharing'); |
@@ -147,6 +151,12 @@ public function getTime(): \DateTimeImmutable { |
147 | 151 | return $this->clock->now(); |
148 | 152 | } |
149 | 153 |
|
| 154 | + #[\Override] |
| 155 | + public function isApiEnabled(): bool { |
| 156 | + // TODO: Enable Unified Sharing API by default |
| 157 | + return $this->legacySharingManager->shareApiEnabled() && $this->config->getSystemValueBool('sharing.unified_api_enable'); |
| 158 | + } |
| 159 | + |
150 | 160 | #[\Override] |
151 | 161 | public function createShare(ShareAccessContext $accessContext): Share { |
152 | 162 | if (!($currentUser = $accessContext->currentUser) instanceof IUser) { |
|
0 commit comments