Skip to content

Commit

Permalink
Merge pull request #5 from concrete5-community/release/1.9.0
Browse files Browse the repository at this point in the history
1.9.0 release branch
  • Loading branch information
hissy authored Mar 19, 2024
2 parents 6e47f04 + f36e743 commit 9ef3f65
Show file tree
Hide file tree
Showing 43 changed files with 872 additions and 382 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.9.0
- Fix interface style fit to version 9 (Bootstrap 5)
- Remove license check (from this version, this package changed to MIT license and maintained by concrete community.)
- Add Tasks for version 9
- Fix some PHP8 related issues

1.8.3
- Fix cookie consent check. Formerly this only worked based on the session cookie. Now it also inspects the cookieconsent_status cookie.

Expand Down
36 changes: 27 additions & 9 deletions config/database_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

'Logs' => [
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.0', // https://github.com/concrete5/concrete5/commit/177429e792c471faa8c3225d20431279930c0bd0
'c5_version' => '8.4.0', // https://github.com/concretecms/concretecms/commit/177429e792c471faa8c3225d20431279930c0bd0
],

'UserSearchIndexAttributes' => [
Expand Down Expand Up @@ -51,40 +51,58 @@
'ConfigStore' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.2', // https://github.com/concrete5/concrete5/commit/f948e4a1927bf44215d774bf3b7463688cc08538
'c5_version' => '8.4.2', // https://github.com/concretecms/concretecms/commit/f948e4a1927bf44215d774bf3b7463688cc08538
],
'ConversationSubscriptions' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.2', // https://github.com/concrete5/concrete5/commit/f948e4a1927bf44215d774bf3b7463688cc08538
'c5_version' => '8.4.2', // https://github.com/concretecms/concretecms/commit/f948e4a1927bf44215d774bf3b7463688cc08538
],
'DownloadStatistics' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.2', // https://github.com/concrete5/concrete5/commit/f948e4a1927bf44215d774bf3b7463688cc08538
'c5_version' => '8.4.2', // https://github.com/concretecms/concretecms/commit/f948e4a1927bf44215d774bf3b7463688cc08538
],
'FileSets' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.2', // https://github.com/concrete5/concrete5/commit/f948e4a1927bf44215d774bf3b7463688cc08538
'c5_version' => '8.4.2', // https://github.com/concretecms/concretecms/commit/f948e4a1927bf44215d774bf3b7463688cc08538
],
'PermissionAccessEntityUsers' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.2', // https://github.com/concrete5/concrete5/commit/f948e4a1927bf44215d774bf3b7463688cc08538
'c5_version' => '8.4.2', // https://github.com/concretecms/concretecms/commit/f948e4a1927bf44215d774bf3b7463688cc08538
],
'authTypeConcreteCookieMap' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.4.2', // https://github.com/concrete5/concrete5/commit/f948e4a1927bf44215d774bf3b7463688cc08538
'c5_version' => '8.4.2', // https://github.com/concretecms/concretecms/commit/f948e4a1927bf44215d774bf3b7463688cc08538
],
'NotificationAlerts' => [
'fixed' => false,
'info' => t('This table is not yet handled by version %s of concrete5. You may be able to update your C5 installation to fix this problem. See also %s.',
'info' => t('This table is not yet handled by version %s of Concrete CMS. You may be able to update your C5 installation to fix this problem. See also %s.',
'8.4.0RC4',
'https://github.com/concrete5/concrete5/issues/6676'
'https://github.com/concretecms/concretecms/issues/6676'
)
],

'UserSignups' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.5.0', // https://github.com/concretecms/concretecms/commit/60800f46af43975a4f61a5a0801b82a939459f5a
],

'ExpressEntityEntries' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '8.5.2', // https://github.com/concretecms/concretecms/commit/863d6e8fa4dbea05f1c38e017f3b42901802e44a
],

'GroupSignups' => [
'fixed' => true,
'info' => t('Records are deleted in the %s class.', 'UserInfo'),
'c5_version' => '9.1.0', // https://github.com/concretecms/concretecms/commit/31d0146ade133118797d65c4bbf9a03228e505f7
]
],
],

Expand Down
58 changes: 55 additions & 3 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

namespace Concrete\Package\Gdpr;

use A3020\Gdpr\DataTransfer\Task\ProcessDataTransferRequestsController;
use A3020\Gdpr\Form\Task\DeleteExpressFormEntriesController;
use A3020\Gdpr\Form\Task\DeleteLegacyFormEntriesController;
use A3020\Gdpr\Help\HelpServiceProvider;
use A3020\Gdpr\Installer\Installer;
use A3020\Gdpr\Installer\TaskInstaller;
use A3020\Gdpr\Installer\Uninstaller;
use A3020\Gdpr\Job\JobInstallService;
use Concrete\Core\Command\Task\Manager as TaskManager;
use Concrete\Core\Config\Repository\Repository;
use Concrete\Core\Package\Package;
use Concrete\Core\Support\Facade\Package as PackageFacade;
Expand All @@ -13,7 +20,7 @@ final class Controller extends Package
{
protected $pkgHandle = 'gdpr';
protected $appVersionRequired = '8.4.4';
protected $pkgVersion = '1.8.3';
protected $pkgVersion = '1.9.0';
protected $pkgAutoloaderRegistries = [
'src/Gdpr' => '\A3020\Gdpr',
];
Expand All @@ -30,13 +37,39 @@ public function getPackageDescription()

public function on_start()
{
$app = $this->app;

/** @var @var \A3020\Gdpr\Provider\GdprServiceProvider $provider */
$provider = $this->app->make(\A3020\Gdpr\Provider\GdprServiceProvider::class);
$provider = $app->make(\A3020\Gdpr\Provider\GdprServiceProvider::class);
$provider->register();

/** @var @var \A3020\Gdpr\Provider\CookieServiceProvider $provider */
$provider = $this->app->make(\A3020\Gdpr\Provider\CookieServiceProvider::class);
$provider = $app->make(\A3020\Gdpr\Provider\CookieServiceProvider::class);
$provider->register();

/** @var HelpServiceProvider $helpServiceProvider */
$helpServiceProvider = $app->make(HelpServiceProvider::class);
$helpServiceProvider->register();

/** @var TaskManager $taskManager */
$taskManager = $app->make(TaskManager::class);
/** @var TaskInstaller $taskInstaller */
$taskInstaller = $app->make(TaskInstaller::class, ['package' => $this->getPackageEntity()]);
if ($taskInstaller->isInstalled('gdpr_process_data_transfer_requests')) {
$taskManager->extend('gdpr_process_data_transfer_requests', static function() use ($app) {
return $app->make(ProcessDataTransferRequestsController::class);
});
}
if ($taskInstaller->isInstalled('gdpr_remove_form_submissions')) {
$taskManager->extend('gdpr_remove_form_submissions', static function() use ($app) {
return $app->make(DeleteExpressFormEntriesController::class);
});
}
if ($taskInstaller->isInstalled('gdpr_remove_legacy_form_submissions')) {
$taskManager->extend('gdpr_remove_legacy_form_submissions', static function() use ($app) {
return $app->make(DeleteLegacyFormEntriesController::class);
});
}
}

public function install()
Expand All @@ -56,6 +89,25 @@ public function upgrade()

$installer = $this->app->make(Installer::class);
$installer->install($pkg);

if (class_exists(TaskManager::class)) {
/** @var JobInstallService $jobInstaller */
$jobInstaller = $this->app->make(JobInstallService::class);
/** @var TaskInstaller $taskInstaller */
$taskInstaller = $this->app->make(TaskInstaller::class, ['package' => $this->getPackageEntity()]);
if ($jobInstaller->isInstalled('gdpr_process_data_transfer_requests')) {
$jobInstaller->installOrDeinstall('gdpr_process_data_transfer_requests', false);
$taskInstaller->install('gdpr_process_data_transfer_requests');
}
if ($jobInstaller->isInstalled('gdpr_remove_form_submissions')) {
$jobInstaller->installOrDeinstall('gdpr_remove_form_submissions', false);
$taskInstaller->install('gdpr_remove_form_submissions');
}
if ($jobInstaller->isInstalled('gdpr_remove_legacy_form_submissions')) {
$jobInstaller->installOrDeinstall('gdpr_remove_legacy_form_submissions', false);
$taskInstaller->install('gdpr_remove_legacy_form_submissions');
}
}
}

public function uninstall()
Expand Down
25 changes: 23 additions & 2 deletions controllers/single_page/dashboard/gdpr/cleanup/express_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@
use A3020\Gdpr\Controller\DashboardController;
use A3020\Gdpr\Form\Express\DeleteFormEntries;
use A3020\Gdpr\Form\Express\ExpressFormHelper;
use A3020\Gdpr\Installer\TaskInstaller;
use A3020\Gdpr\Job\JobInstallService;
use A3020\Gdpr\Traits\PackageTrait;
use Concrete\Core\Express\EntryList;
use Concrete\Core\Support\Facade\Log;
use Concrete\Core\Tree\Node\Type\ExpressEntryCategory;
use Exception;

final class ExpressForms extends DashboardController
{
use PackageTrait;

/** @var JobInstallService */
protected $jobInstallService;

/** @var TaskInstaller */
protected $taskInstaller;

public function on_start()
{
parent::on_start();

$this->jobInstallService = $this->app->make(JobInstallService::class);
$this->taskInstaller = $this->app->make(TaskInstaller::class, ['package' => $this->getPackage()]);
}

public function view()
Expand All @@ -35,9 +43,14 @@ public function view()
}

$this->set('formInformation', $formInformation);
$this->set('enableJobToRemoveFormSubmissions', $this->jobInstallService->isInstalled('gdpr_remove_form_submissions'));
if ($this->isVersion9()) {
$this->set('enableJobToRemoveFormSubmissions', $this->taskInstaller->isInstalled('gdpr_remove_form_submissions'));
} else {
$this->set('enableJobToRemoveFormSubmissions', $this->jobInstallService->isInstalled('gdpr_remove_form_submissions'));
}
$this->set('deleteAssociatedFiles', $this->config->get('gdpr.settings.express_forms.delete_files', false));
$this->set('expressFormsKeepDays', $this->config->get('gdpr.settings.express_forms.keep_days'));
$this->set('isVersion9', $this->isVersion9());
}

public function save()
Expand All @@ -48,7 +61,15 @@ public function save()
return $this->action('/dashboard/gdpr/cleanup/express_forms');
}

$this->jobInstallService->installOrDeinstall('gdpr_remove_form_submissions', $this->post('enableJobToRemoveFormSubmissions'));
if ($this->isVersion9()) {
if ($this->post('enableJobToRemoveFormSubmissions')) {
$this->taskInstaller->install('gdpr_remove_form_submissions');
} else {
$this->taskInstaller->uninstall('gdpr_remove_form_submissions');
}
} else {
$this->jobInstallService->installOrDeinstall('gdpr_remove_form_submissions', $this->post('enableJobToRemoveFormSubmissions'));
}

$keepDays = $this->post('expressFormsKeepDays');
$this->config->save('gdpr.settings.express_forms.keep_days', $keepDays !== '' ? (int) $keepDays : null);
Expand Down
25 changes: 23 additions & 2 deletions controllers/single_page/dashboard/gdpr/cleanup/legacy_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,38 @@
namespace Concrete\Package\Gdpr\Controller\SinglePage\Dashboard\Gdpr\Cleanup;

use A3020\Gdpr\Controller\DashboardController;
use A3020\Gdpr\Installer\TaskInstaller;
use A3020\Gdpr\Job\JobInstallService;
use A3020\Gdpr\Traits\PackageTrait;
use Concrete\Core\Database\Connection\Connection;

final class LegacyForms extends DashboardController
{
use PackageTrait;

/** @var JobInstallService */
protected $jobInstallService;

/** @var TaskInstaller */
protected $taskInstaller;

public function on_start()
{
parent::on_start();

$this->jobInstallService = $this->app->make(JobInstallService::class);
$this->taskInstaller = $this->app->make(TaskInstaller::class, ['package' => $this->getPackage()]);
$this->set('isVersion9', $this->isVersion9());
}

public function view()
{
$this->set('totalFormSubmissions', $this->getTotalFormSubmissions());
$this->set('enableJobToRemoveLegacyFormSubmissions', $this->jobInstallService->isInstalled('gdpr_remove_legacy_form_submissions'));
if ($this->isVersion9()) {
$this->set('enableJobToRemoveLegacyFormSubmissions', $this->taskInstaller->isInstalled('gdpr_remove_legacy_form_submissions'));
} else {
$this->set('enableJobToRemoveLegacyFormSubmissions', $this->jobInstallService->isInstalled('gdpr_remove_legacy_form_submissions'));
}
$this->set('legacyFormsKeepDays', $this->config->get('gdpr.settings.legacy_forms.keep_days'));
}

Expand All @@ -33,7 +46,15 @@ public function save()
return $this->action('/dashboard/gdpr/cleanup/legacy_forms');
}

$this->jobInstallService->installOrDeinstall('gdpr_remove_legacy_form_submissions', $this->post('enableJobToRemoveLegacyFormSubmissions'));
if ($this->isVersion9()) {
if ($this->post('enableJobToRemoveLegacyFormSubmissions')) {
$this->taskInstaller->install('gdpr_remove_legacy_form_submissions');
} else {
$this->taskInstaller->uninstall('gdpr_remove_legacy_form_submissions');
}
} else {
$this->jobInstallService->installOrDeinstall('gdpr_remove_legacy_form_submissions', $this->post('enableJobToRemoveLegacyFormSubmissions'));
}

$keepDays = $this->post('legacyFormsKeepDays');
$this->config->save('gdpr.settings.legacy_forms.keep_days', $keepDays !== '' ? (int) $keepDays : null);
Expand Down
47 changes: 24 additions & 23 deletions controllers/single_page/dashboard/gdpr/data_breach/notify_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,38 @@ public function send()
{
$group = Group::getByID($this->post('user_group'));
if (!$group) {
$this->flash('error', t('Invalid user group'));
return $this->action('/dashboard/gdpr/data_breach/notify_users');
$this->error->add(t('Invalid user group'));
}

try {
$userEmails = $this->getUserEmails($group->getGroupMemberIDs());
$this->sendEmail(
$this->post('fromName'),
$this->post('fromEmail'),
$this->post('subject'),
$this->post('message'),
$userEmails
);
} catch (Exception $e) {
$this->error = t('Something went wrong: '.$e->getMessage());

return $this->view();
if (!$this->error->has()) {
try {
$userEmails = $this->getUserEmails($group->getGroupMemberIDs());
$this->sendEmail(
$this->post('fromName'),
$this->post('fromEmail'),
$this->post('subject'),
$this->post('message'),
$userEmails
);
$this->flash('success', t2(
'The notification has been sent to %s user.',
'The notification has been sent to %s users.',
$group->getGroupMembersNum()
));

return $this->buildRedirect('/dashboard/gdpr/data_breach/notify_users/sent');
} catch (Exception $e) {
$this->error->add(t('Something went wrong: ' . $e->getMessage()));
}
}

$this->flash('success', t2(
'The notification has been sent to %s user.',
'The notification has been sent to %s users.',
$group->getGroupMembersNum()
));

return $this->action('/dashboard/gdpr/data_breach/notify_users/sent');
$this->view();
}

public function sent()
{
$this->set('sent', true);
$this->view();
}

/**
Expand All @@ -80,7 +81,7 @@ private function getUserGroups()
continue;
}

$groups[$group->getGroupID()] = $group->getGroupDisplayName() .' ('.t2('%s user', '%s users', $numberOfUsers).')';
$groups[$group->getGroupID()] = $group->getGroupDisplayName(false) .' ('.t2('%s user', '%s users', $numberOfUsers).')';
}

return $groups;
Expand Down
Loading

0 comments on commit 9ef3f65

Please sign in to comment.