Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHRAS-4078_ExpiringRight-to-core #4526

Merged
merged 6 commits into from
Jul 17, 2024
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
3 changes: 3 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace KonsoleKommander;
use Alchemy\Phrasea\CLI;
use Alchemy\Phrasea\Command\ApplyRightsCommand;
use Alchemy\Phrasea\Command\BuildMissingSubdefs;
use Alchemy\Phrasea\Command\ExpiringRights\AlertExpiringRightsCommand;
use Alchemy\Phrasea\Command\Record\BuildPermalinks;
use Alchemy\Phrasea\Command\Record\BuildSubdefs;
use Alchemy\Phrasea\Command\CheckConfig;
Expand Down Expand Up @@ -194,6 +195,8 @@ $cli->command(new SendValidationRemindersCommand());

$cli->command(new NetworkProxiesTestCommand('network-proxies:test'));

$cli->command(new AlertExpiringRightsCommand());

$cli->loadPlugins();

$cli->run();
39 changes: 39 additions & 0 deletions config/configuration.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,42 @@ translator:
# end of job : change coll status
set_status: 10xxxx
set_collection: online
expiring-rights:
version: 3
jobs:
# "I want to alert owners that records have expired"
- rights-expired-owners:
active: false
target: "owners"
databox: "db_with_rights"
collection: [ "Promo", "Selections" ]
expire_field: ExpireDate
prior_notice: -60
set_status: 01xxxx
alerts:
- method: webhook
recipient: ["[email protected]", "[email protected]"]

# "I want to alert users who have downloaded that a document rights will expire in 60 days"
- rights-60-downloaders:
active: false
target: "downloaders"
databox: "db_with_rights"
collection: [ "Promo", "Selections" ]
downloaded: [ "document", "preview" ]
expire_field: "ExpirationDate"
prior_notice: -60
alerts:
- method: "webhook"

# "I want to alert users who have downloaded that a document rights has expired"
- rights-expired-dowloaders:
active: false
target: "downloaders"
databox: "db_with_rights"
collection: [ "Promo", "Selections" ]
downloaded: [ "document", "preview" ]
expire_field: "ExpirationDate"
prior_notice: 0
alerts:
- method: "webhook"
4 changes: 4 additions & 0 deletions lib/Alchemy/Phrasea/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
use Alchemy\Phrasea\Authorization\AuthorizationServiceProvider;
use Alchemy\Phrasea\Core\Event\Subscriber\BasketSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\BridgeSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\ExpiringRightsSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\ExportSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\FeedEntrySubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\LazaretSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaInstallSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\RegistrationSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\ValidationSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\WebhookUserEventSubscriber;
use Alchemy\Phrasea\Core\LazyLocator;
use Alchemy\Phrasea\Core\MetaProvider\DatabaseMetaProvider;
use Alchemy\Phrasea\Core\MetaProvider\HttpStackMetaProvider;
use Alchemy\Phrasea\Core\MetaProvider\MediaUtilitiesMetaServiceProvider;
Expand Down Expand Up @@ -767,6 +769,8 @@ private function setupEventDispatcher()
$dispatcher->addSubscriber(new WebhookUserEventSubscriber($app));
}

$dispatcher->addSubscriber(new ExpiringRightsSubscriber($app, new LazyLocator($app, 'phraseanet.appbox')));

return $dispatcher;
})
);
Expand Down
Loading
Loading