PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Controllers/Form/DuplicateFormController.php +12 -10 0.6.1.1 → 1.5 View file →
@@ -6,13 +6,8 @@
6 6 */
7 7
8 8 namespace IvyForms\Controllers\Form;
9 9
10 -// phpcs:disable PSR1.Files.SideEffects
11 -if (!defined('ABSPATH')) {
12 - exit; // Exit if accessed directly
13 -}
14 -
15 10 use IvyForms\Common\Exceptions\ForbiddenException;
16 11 use IvyForms\Common\Exceptions\InvalidArgumentException;
17 12 use IvyForms\Common\Exceptions\NotFoundException;
18 13 use IvyForms\Common\Exceptions\QueryExecutionException;
@@ -23,8 +18,9 @@
23 18 use IvyForms\Services\Confirmation\ConfirmationService;
24 19 use IvyForms\Services\Field\FieldService;
25 20 use IvyForms\Services\Form\FormService;
26 21 use IvyForms\Services\Notification\NotificationService;
22 +use IvyForms\Services\Permissions\AccessRulesFormScopeExtender;
27 23 use IvyForms\Services\Translations\BackendStrings;
28 24 use WP_REST_Request;
29 25 use WP_REST_Response;
30 26
@@ -39,18 +35,22 @@
39 35 private FieldService $fieldService;
40 36 private NotificationService $notificationService;
41 37 private ConfirmationService $confirmationService;
42 38
39 + private AccessRulesFormScopeExtender $accessRulesFormScopeExtender;
40 +
43 41 public function __construct(
44 42 FormService $formService,
45 43 FieldService $fieldService,
46 44 NotificationService $notificationService,
47 - ConfirmationService $confirmationService
45 + ConfirmationService $confirmationService,
46 + AccessRulesFormScopeExtender $accessRulesFormScopeExtender
48 47 ) {
49 - $this->formService = $formService;
50 - $this->fieldService = $fieldService;
51 - $this->notificationService = $notificationService;
52 - $this->confirmationService = $confirmationService;
48 + $this->formService = $formService;
49 + $this->fieldService = $fieldService;
50 + $this->notificationService = $notificationService;
51 + $this->confirmationService = $confirmationService;
52 + $this->accessRulesFormScopeExtender = $accessRulesFormScopeExtender;
53 53 }
54 54
55 55 /**
56 56 * @param WP_REST_Request $data
@@ -81,8 +81,10 @@
81 81
82 82 $this->fieldService->duplicateFields($formId, $newFormId);
83 83 $this->notificationService->duplicateNotifications($formId, $newFormId);
84 84 $this->confirmationService->duplicateConfirmations($formId, $newFormId);
85 +
86 + $this->accessRulesFormScopeExtender->appendCreatedFormToCurrentUserScope($newFormId);
85 87
86 88 return new WP_REST_Response([
87 89 'message' => BackendStrings::getCommonStrings()['ok'],
88 90 'data' => $this->formService->getFormById($newFormId)->toArray()