Re: User access via webservice
Hello,
we are having the following problem: our userdatabase is in an ldap directory and we want to use the information there in the created_by and changed_by fields. We want to perform these steps:
* our website is autheniticating the user agains ldap - works
* our website checks if there is an associated person entry in indicia, if not it creates one via the data service - works
* our website checks if there is an user associated to the person, and if not it creates one - does not work
* our website uses the user_id when submitting data - works partially
check and create user entry
The users webservice does not filter on person_id. As a workaround I've added person_id to the view list_users.
Saving users using the submission service seems not possible. If I want to create a user for an exsinsting person I get the following answer:
{"error":"Unknown Exception: Validation error","errors":{"user:general":"Undefined index: id"}}
And the log says:
2011-10-17 13:27:45 +02:00 --- error: #8: Exception during validation. Undefined index: id at line 52 in file /var/www-test/htdocs/indicia/application/models/user.php
2011-10-17 13:27:45 +02:00 --- debug: Stack trace:
/var/www-test/htdocs/indicia/application/models/user.php - line 52 - indicia_error_handler
/var/www-test/htdocs/indicia/application/libraries/MY_ORM.php - line 493 - validate
/var/www-test/htdocs/indicia/application/libraries/MY_ORM.php - line 431 - validateAndSubmit
/var/www-test/htdocs/indicia/application/libraries/MY_ORM.php - line 395 - inner_submit
/var/www-test/htdocs/indicia/modules/indicia_svc_data/controllers/services/data.php - line 881 - submit
/var/www-test/htdocs/indicia/modules/indicia_svc_data/controllers/services/data.php - line 869 - submit_single
/var/www-test/htdocs/indicia/modules/indicia_svc_data/controllers/services/data.php - line 840 - submit
Unknown file - line Unknown - save
/var/www-test/htdocs/indicia/system/core/Kohana.php - line 291 - invokeArgs
Unknown file - line Unknown - instance
/var/www-test/htdocs/indicia/system/core/Event.php - line 209 - call_user_func
/var/www-test/htdocs/indicia/system/core/Bootstrap.php - line 55 - run
/var/www-test/htdocs/indicia/index.php - line 112 - require
2011-10-17 13:27:45 +02:00 --- debug: Record did not validate
2011-10-17 13:27:45 +02:00 --- debug: Field general: Undefined index: id
2011-10-17 13:27:45 +02:00 --- debug: Done inner submit of model user with result
2011-10-17 13:27:45 +02:00 --- debug: <pre>(array) Array
(
[user:general] => Undefined index: id
)
</pre>
2011-10-17 13:27:45 +02:00 --- debug: Rolling back transaction.
Submitted data is:
[submission] => {"id":"user","fields":{"core_role_id":{"value":"1"},"username":{"value":"user.name"},"person_id":{"value":"323"}}}
Setting created_by_id on submitting data
If I set breated_by_id on a submission and read the entety from the warehouse, it says correctly created_by_id=xxx but updated_by_id=1
Regards
Daniel