| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | 'message' => __('Security check failed. Please refresh and try again.', 'fluent-booking'), |
| 16 | 16 | ]); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if (!PermissionManager::userCan(['invite_team_members', 'manage_all_data', 'manage_other_calendars'])) { | |
| 19 | + if (!PermissionManager::userCan(['manage_all_data', 'manage_other_calendars'])) { | |
| 20 | 20 | wp_send_json_error([ |
| 21 | 21 | 'message' => __('You are not authorized to import calendar', 'fluent-booking'), |
| 22 | 22 | ]); |
| 23 | 23 | } |
| @@ -49,9 +49,11 @@ | ||
| 49 | 49 | 'message' => __('Invalid file. Please provide a valid JSON file', 'fluent-booking'), |
| 50 | 50 | ]); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $calendar = CalendarService::createCalendar($calendarData, false, true); | |
| 53 | + $useCurrentUser = !PermissionManager::userCan('manage_all_data'); | |
| 54 | + | |
| 55 | + $calendar = CalendarService::createCalendar($calendarData, $useCurrentUser, true); | |
| 54 | 56 | |
| 55 | 57 | if (is_wp_error($calendar)) { |
| 56 | 58 | wp_send_json_error([ |
| 57 | 59 | 'message' => $calendar->get_error_message(), |