@@ -50,6 +50,13 @@ function os2web_cp_service_handler() {
50
50
if (!os2web_esdh_provider_has_api('cp')) {
51
51
drupal_access_denied();
52
52
}
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
+
53
60
$data = os2web_esdh_provider_invoke('cp', 'handle_request');
54
61
return $data;
55
62
}
@@ -217,7 +224,7 @@ function os2web_cp_service_create_case(array $data) {
217
224
218
225
switch ($field_info['type']) {
219
226
case 'text':
220
- if ($field['label'] === 'Sagstitel') {
227
+ if ($field['label'] === 'Sagstitel' && $data['fields']['Sagstype - Sagstype'] === 'EJSAG' ) {
221
228
$node->{$field_name}[LANGUAGE_NONE][0]['value'] = (string) preg_replace('/\s\(\d{4}\)/', '', $data['fields']['Sagstitel']);
222
229
}
223
230
else {
@@ -785,7 +792,7 @@ function os2web_cp_service_preprocess_views_exposed_form(&$variables) {
785
792
*/
786
793
function os2web_cp_service_theme_registry_alter(&$theme_registry) {
787
794
// Add the tpl for exposed form to the theme registry
788
- // Somehow this gets overridden by cmstheme .
795
+ // Somehow this gets overridden by os2web_core_theme .
789
796
if (!empty($theme_registry['views_exposed_form__os2web_cp_service_cp_case_search']['path'])) {
790
797
$theme_registry['views_exposed_form__os2web_cp_service_cp_case_search']['path'] = drupal_get_path('module', 'os2web_cp_service') . '/theme/';
791
798
}
@@ -815,6 +822,12 @@ function os2web_cp_service_form_os2web_settings_settings_form_alter(&$form, &$fo
815
822
'#title' => t('CP File endpoint password'),
816
823
'#description' => t('CP File endpoint HTTP authentification password.'),
817
824
);
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
+ );
818
831
}
819
832
820
833
/**
0 commit comments