Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set custom attribute using the SOAP API (if none already set) #1401

Closed
Bakaras opened this issue May 20, 2022 · 2 comments · Fixed by #1402
Closed

Unable to set custom attribute using the SOAP API (if none already set) #1401

Bakaras opened this issue May 20, 2022 · 2 comments · Fixed by #1402
Labels
Milestone

Comments

@Bakaras
Copy link

Bakaras commented May 20, 2022

Version

6.2.60

Installation method

deb

Expected behavior

Custom attributes are set without error.

Actual behavior

Error message appears:
Soap Error:
faultstring = Can't use an undefined value as a HASH reference at /usr/share/sympa/lib/Sympa/WWW/SOAP.pm line 1500.

Steps to reproduce

  1. Add new subscriber to list:
sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd
--soap_url=https://listen.dom.ain/sympasoap --service=add --proxy_vars=USER_EMAIL=listowner@dom.ain 
--service_parameters=testlist1,john@example.abc,,1

Output:

calling authenticateRemoteAppAndRun( trustedapp, tapasswd, USER_EMAIL=listowner@dom.ain,add,testlist1,john@example.abc,,1)
0
	'1'
  1. Set a custom attribute:
sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd 
--soap_url=https://listen.dom.ain/sympasoap --service=setCustom 
--proxy_vars=USER_EMAIL=john@example.abc --service_parameters=testlist1,forename,John

Soap-error:

calling authenticateRemoteAppAndRun( trustedapp, tapasswd, USER_EMAIL=john@example.abc,setCustom,testlist1,forename,John)
Soap error :
faultcode = soap:Server
faultstring = Can't use an undefined value as a HASH reference at /usr/share/sympa/lib/Sympa/WWW/SOAP.pm line 1500.

Additional information

@Bakaras
Copy link
Author

Bakaras commented May 20, 2022

Changing the SOAP.pm file fixes the error:

--- SOAP.pm.orig	2021-02-07 17:02:26.000000000 +0100
+++ SOAP.pm.ok	2022-05-12 20:23:52.312000000 +0200
@@ -1497,7 +1497,10 @@
             ->faultstring('Not a subscriber to this list')
             ->faultdetail('Use : <list> <key> <value> ');
     }
-    %newcustom = %{$subscriber->{'custom_attribute'}};
+
+    if ($subscriber->{'custom_attribute'}) {
+        %newcustom = %{$subscriber->{'custom_attribute'}};
+    }
     #if(! defined $list->{'admin'}{'custom_attribute'}{$key} ) {
     #	return SOAP::Data->name('result')->type('boolean')->value(0);
     #}

Custom attribute are set without error.

# sympa_soap_client.pl --trusted_application=trustedapp --trusted_application_password=tapasswd 
--soap_url=https://listen.dom.ain/sympasoap --service=setCustom 
--proxy_vars=USER_EMAIL=john@example.abc --service_parameters=testlist1,forename,John

Output:

calling authenticateRemoteAppAndRun( trusteadapp, tapasswd, USER_EMAIL=john@example.abc,setCustom,testlist1,forename,John)
0
	'1'

getDetails of subscriber:

# sympa_soap_client.pl --trusted_application=trustedapp
--trusted_application_password=tapasswd
--soap_url=https://listen.dom.ain/sympasoap --service=getDetails 
--proxy_vars=USER_EMAIL=john@example.abc 
--service_parameters=testlist1

Output:

calling authenticateRemoteAppAndRun( trustedapp, tapasswd, USER_EMAIL=john@example.abc,getDetails,testlist1)
0
	_custom_
		0
			_key_
				'forename'
			_value_
				'John'
	_gecos_
		''
	_reception_
		'mail'
	_subscribeDate_
		'1653085438'
	_updateDate_
		'1653085438'

@ikedas ikedas added the bug label May 21, 2022
ikedas added a commit that referenced this issue May 28, 2022
Unable to set custom attribute using the SOAP API (if none already set) (#1401)
@ikedas
Copy link
Member

ikedas commented May 28, 2022

@Bakaras , the fix of this bug will be included in the next release of Sympa. Thank you for reporting the bug and suggesting fix!

@ikedas ikedas added this to the 6.2.70 milestone Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants