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 -5 1.0 → 1.5 View file →
@@ -18,8 +18,9 @@
18 18 use IvyForms\Services\Confirmation\ConfirmationService;
19 19 use IvyForms\Services\Field\FieldService;
20 20 use IvyForms\Services\Form\FormService;
21 21 use IvyForms\Services\Notification\NotificationService;
22 +use IvyForms\Services\Permissions\AccessRulesFormScopeExtender;
22 23 use IvyForms\Services\Translations\BackendStrings;
23 24 use WP_REST_Request;
24 25 use WP_REST_Response;
25 26
@@ -34,18 +35,22 @@
34 35 private FieldService $fieldService;
35 36 private NotificationService $notificationService;
36 37 private ConfirmationService $confirmationService;
37 38
39 + private AccessRulesFormScopeExtender $accessRulesFormScopeExtender;
40 +
38 41 public function __construct(
39 42 FormService $formService,
40 43 FieldService $fieldService,
41 44 NotificationService $notificationService,
42 - ConfirmationService $confirmationService
45 + ConfirmationService $confirmationService,
46 + AccessRulesFormScopeExtender $accessRulesFormScopeExtender
43 47 ) {
44 - $this->formService = $formService;
45 - $this->fieldService = $fieldService;
46 - $this->notificationService = $notificationService;
47 - $this->confirmationService = $confirmationService;
48 + $this->formService = $formService;
49 + $this->fieldService = $fieldService;
50 + $this->notificationService = $notificationService;
51 + $this->confirmationService = $confirmationService;
52 + $this->accessRulesFormScopeExtender = $accessRulesFormScopeExtender;
48 53 }
49 54
50 55 /**
51 56 * @param WP_REST_Request $data
@@ -76,8 +81,10 @@
76 81
77 82 $this->fieldService->duplicateFields($formId, $newFormId);
78 83 $this->notificationService->duplicateNotifications($formId, $newFormId);
79 84 $this->confirmationService->duplicateConfirmations($formId, $newFormId);
85 +
86 + $this->accessRulesFormScopeExtender->appendCreatedFormToCurrentUserScope($newFormId);
80 87
81 88 return new WP_REST_Response([
82 89 'message' => BackendStrings::getCommonStrings()['ok'],
83 90 'data' => $this->formService->getFormById($newFormId)->toArray()