Webservice behavior is dependent of tab order in JSON
Webservice behavior is dependent of tab order in JSON
Hi!
Description
Using the rest API (https://rest-api.fusiondirectory.info), I cannot create a group with mail address, I get this error [{"message":"This tab does not exists: "mailGroup"","line":469,"file":"/usr/share/fusiondirectory/include/webservice/class_fdRPCService.inc"}]
Mail address can only be added to group on update, never during creation. I've noticed it only happens when the mailGroup tab is placed before the ogroup tab in the posted data (group creation succeeds if the mailGroup is placed after the ogroup).
I don't have this error when adding a user with a mail address when the mailAccount tab is placed before the user tab in the posted data.
Also, I've noticed something strange: setting a mail to a group during update only works if the group contains at least one valid member: having a 'fake' member value such as "cn=empty" (that is set by refint overlay or for synchronization purpose), mail cannot be set using an update request (still the tab does not exists error), and in the UI, the mail tab is not displayed at all, while it's usually greyed.
Distribution Name and Version
Centos 7
FusionDirectory Version
Fusion directory 1.4-dev
PHP version used
PHP 7.4.16
Steps to Reproduce
(replace base and member to match existing base/user)
curl -X POST -H "Session-Token: $FD_TOKEN" https://fd.poc-sync.wsweet.cloud/rest.php/v1/objects/OGROUP -d '{"attrs":{"mailGroup":{"mail":"test-group@wsweet.local"},"ogroup":{"cn":"test-group","base":"o=poc-sync,dc=wsweet,dc=cloud","description":"Liste de diffusion","member":["uid=someone,ou=users,o=poc-sync,dc=wsweet,dc=cloud"]}}}'
[{"message":"This tab does not exists: \"mailGroup\"","line":469,"file":"/usr/share/fusiondirectory/include/webservice/class_fdRPCService.inc"}]
Expected behavior:
Should work like it does for user creation :
(replace base to match existing base)
curl -X POST -H "Session-Token: $FD_TOKEN" https://fd.poc-sync.wsweet.cloud/rest.php/v1/objects/USER -d '{"attrs":{"mailAccount":{"mail":"test-user@wsweet.local"},"user":{"uid":"test-user","givenName":"test","sn":"user","base":"o=poc-sync,dc=wsweet,dc=cloud"}}}'
"uid=test-user,ou=users,o=poc-sync,dc=wsweet,dc=cloud"
Additional Information
I'm testing/using a FD LSC plugin.