Skip to content

Commit f739d31

Browse files
committed
Restrict access to IP addresses on publish.
1 parent 8b38564 commit f739d31

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

os2web_cp_service.module

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ function os2web_cp_service_handler() {
5050
if (!os2web_esdh_provider_has_api('cp')) {
5151
drupal_access_denied();
5252
}
53+
54+
$ip_string = variable_get('os2web_cp_service_cp_access_ip', '');
55+
$valid_ips = array_map('trim', explode(',', $ip_string));
56+
if (!in_array(ip_address(), $valid_ips)) {
57+
drupal_access_denied();
58+
}
59+
5360
$data = os2web_esdh_provider_invoke('cp', 'handle_request');
5461
return $data;
5562
}
@@ -815,6 +822,12 @@ function os2web_cp_service_form_os2web_settings_settings_form_alter(&$form, &$fo
815822
'#title' => t('CP File endpoint password'),
816823
'#description' => t('CP File endpoint HTTP authentification password.'),
817824
);
825+
$form['os2web_cp_service_config_group']['os2web_cp_service_cp_access_ip'] = array(
826+
'#type' => 'textfield',
827+
'#title' => 'IP addresser der kan tilgå publiserings webservicen',
828+
'#description' => 'Komma separeret liste af ip-addresser der kan tilgå <em>webservicen</em>.',
829+
'#default_value' => variable_get('os2web_cp_service_cp_access_ip', ip_address()),
830+
);
818831
}
819832

820833
/**

0 commit comments

Comments
 (0)