← All changes
|
Modules/Migrations/Http/Controllers/BPMigrationController.php
+14
-6
2.8.1
→
2.10.0
View file →
| @@ -45,15 +45,23 @@ | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function startMigration(Request $request) |
| 48 | 48 | { |
| 49 | - // Validate the destructive confirmation before mutating anything, so a rejected request | |
| 49 | + // Validate the destructive request before mutating anything, so a rejected request | |
| 50 | 50 | // never clears saved migration progress. |
| 51 | - if ($request->get('delete_current_data') === 'yes' && $request->get('delete_current_data_confirmation') !== 'DELETE') { | |
| 52 | - return $this->sendError([ | |
| 53 | - // translators: %s is the confirmation word the user must type (DELETE) | |
| 54 | - 'message' => sprintf(__('Please type %s to confirm permanently removing all existing FluentCommunity data.', 'fluent-community'), 'DELETE') | |
| 55 | - ]); | |
| 51 | + if ($request->get('delete_current_data') === 'yes') { | |
| 52 | + if (!Helper::isSuperAdmin()) { | |
| 53 | + return $this->sendError([ | |
| 54 | + 'message' => __('You do not have permission to delete existing FluentCommunity data.', 'fluent-community') | |
| 55 | + ], 403); | |
| 56 | + } | |
| 57 | + | |
| 58 | + if ($request->get('delete_current_data_confirmation') !== 'DELETE') { | |
| 59 | + return $this->sendError([ | |
| 60 | + // translators: %s is the confirmation word the user must type (DELETE) | |
| 61 | + 'message' => sprintf(__('Please type %s to confirm permanently removing all existing FluentCommunity data.', 'fluent-community'), 'DELETE') | |
| 62 | + ]); | |
| 63 | + } | |
| 56 | 64 | } |
| 57 | 65 | |
| 58 | 66 | if ($request->get('reset_migration') === 'yes') { |
| 59 | 67 | update_option('_fcom_bp_migrations_status', [], false); |