Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/files/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use OCA\Files\Sharing\Permission\NodeUpdateSharePermissionType;
use OCA\Files\Sharing\Property\NodeGridViewSharePropertyType;
use OCA\Files\Sharing\Source\NodeShareSourceType;
use OCA\Files_Trashbin\Events\MoveToTrashEvent;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand All @@ -58,6 +59,7 @@
use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
use OCP\Files\Events\Node\NodeCopiedEvent;
use OCP\Files\Events\Node\NodeDeletedEvent;
use OCP\Files\Events\NodeAddedToFavorite;
use OCP\Files\Events\NodeRemovedFromFavorite;
use OCP\Interaction\RestrictInteractionEvent;
Expand Down Expand Up @@ -139,6 +141,9 @@ public function register(IRegistrationContext $context): void {
$registry->registerPermissionType(NodeShareSourceType::class, Server::get(NodeDownloadSharePermissionType::class));
$registry->markPermissionTypeCompatibleWithPermissionPreset(NodeDownloadSharePermissionType::class, ViewSharePermissionPreset::class);
$registry->markPermissionTypeCompatibleWithPermissionPreset(NodeDownloadSharePermissionType::class, EditSharePermissionPreset::class);

$context->registerEventListener(NodeDeletedEvent::class, NodeShareSourceType::class);
$context->registerEventListener(MoveToTrashEvent::class, NodeShareSourceType::class);
}

#[\Override]
Expand Down
2 changes: 0 additions & 2 deletions apps/files/lib/Sharing/Source/NodeShareSourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public function __construct(
private ISharingManager $manager,
private IFileAccess $fileAccess,
) {
$eventDispatcher->addServiceListener(NodeDeletedEvent::class, self::class);
$eventDispatcher->addServiceListener(MoveToTrashEvent::class, self::class);
}

#[\Override]
Expand Down
4 changes: 4 additions & 0 deletions apps/sharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

namespace OCA\Sharing\AppInfo;

use OC\Sharing\SharingManager;
use OCA\Sharing\Capabilities;
use OCA\Sharing\Middleware\ShareApiEnabledMiddleware;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\User\Events\BeforeUserDeletedEvent;

final class Application extends App implements IBootstrap {
public const string APP_ID = 'sharing';
Expand All @@ -27,6 +29,8 @@ public function __construct(array $urlParams = []) {
public function register(IRegistrationContext $context): void {
$context->registerCapability(Capabilities::class);
$context->registerMiddleware(ShareApiEnabledMiddleware::class);

$context->registerEventListener(BeforeUserDeletedEvent::class, SharingManager::class);
}

#[\Override]
Expand Down
14 changes: 8 additions & 6 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,14 @@
<code><![CDATA[getSubject]]></code>
</DeprecatedMethod>
</file>
<file src="core/AppInfo/Application.php">
<InvalidArgument>
<code><![CDATA[TeamShareRecipientType::class]]></code>
</InvalidArgument>
<UndefinedClass>
<code><![CDATA[DestroyingCircleEvent]]></code>
</UndefinedClass>
</file>
<file src="core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php">
<DeprecatedClass>
<code><![CDATA[Files::rmdirr($dir)]]></code>
Expand Down Expand Up @@ -2968,15 +2976,9 @@
<ImplementedParamTypeMismatch>
<code><![CDATA[$event]]></code>
</ImplementedParamTypeMismatch>
<InvalidArgument>
<code><![CDATA[self::class]]></code>
</InvalidArgument>
<InvalidTemplateParam>
<code><![CDATA[IEventListener]]></code>
</InvalidTemplateParam>
<UndefinedClass>
<code><![CDATA[DestroyingCircleEvent]]></code>
</UndefinedClass>
<UndefinedDocblockClass>
<code><![CDATA[$event]]></code>
<code><![CDATA[TeamShareRecipientType]]></code>
Expand Down
6 changes: 6 additions & 0 deletions core/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OC\DirectEditing\Listeners\UserDisabledTokenCleanupListener as UserDisabledDirectEditingTokenCleanupListener;
use OC\OCM\OCMDiscoveryHandler;
use OC\TagManager;
use OCA\Circles\Events\DestroyingCircleEvent;
use OCP\Accounts\UserUpdatedEvent;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
Expand All @@ -55,6 +56,7 @@
use OCP\Config\BeforeAppConfigSetEvent;
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\DB\Events\AddMissingPrimaryKeyEvent;
use OCP\Group\Events\BeforeGroupDeletedEvent;
use OCP\IAppConfig;
use OCP\Interaction\RestrictInteractionEvent;
use OCP\Navigation\Events\LoadAdditionalEntriesEvent;
Expand Down Expand Up @@ -166,6 +168,10 @@ public function register(IRegistrationContext $context): void {
if (!Server::get(IAppConfig::class)->getValueBool('files_sharing', 'shareapi_exclude_reshare_from_edit')) {
$registry->markPermissionTypeCompatibleWithPermissionPreset(ReshareSharePermissionType::class, EditSharePermissionPreset::class);
}

$context->registerEventListener(BeforeGroupDeletedEvent::class, GroupShareRecipientType::class);
$context->registerEventListener(DestroyingCircleEvent::class, TeamShareRecipientType::class);
$context->registerEventListener(BeforeUserDeletedEvent::class, UserShareRecipientType::class);
}

#[\Override]
Expand Down
1 change: 0 additions & 1 deletion core/Sharing/Recipient/GroupShareRecipientType.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function __construct(
private readonly IGroupManager $groupManager,
private readonly ISharingManager $manager,
) {
$eventDispatcher->addServiceListener(BeforeGroupDeletedEvent::class, self::class);
}

#[\Override]
Expand Down
1 change: 0 additions & 1 deletion core/Sharing/Recipient/TeamShareRecipientType.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function __construct(
private readonly IDBConnection $dbConnection,
private readonly ISharingManager $manager,
) {
$eventDispatcher->addServiceListener(DestroyingCircleEvent::class, self::class);
}

// CirclesManager class is not registered yet when the class is instantiated.
Expand Down
1 change: 0 additions & 1 deletion core/Sharing/Recipient/UserShareRecipientType.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function __construct(
private readonly IUserManager $userManager,
private readonly ISharingManager $manager,
) {
$eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, self::class);
}

#[\Override]
Expand Down
2 changes: 0 additions & 2 deletions lib/private/Sharing/SharingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public function __construct(
) {
$this->randomizer = new Randomizer();
$this->l10n = $l10nFactory->get('sharing');

$this->eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, self::class);
}

#[\Override]
Expand Down
Loading