summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_api_service_user.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-02-21 17:41:07 +0100
committerAleksander Machniak <machniak@kolabsys.com>2012-02-21 17:41:07 +0100
commit55ccedbce9f335aff55cce39de90cd5e7e8ac771 (patch)
tree96c841689c8615f75cdaf547074d51f23867d2de /lib/api/kolab_api_service_user.php
parentcb9f5ab425055e4ae5740d9674c31348c7289050 (diff)
downloadwebadmin-55ccedbce9f335aff55cce39de90cd5e7e8ac771.tar.gz
Generate empty auto-fields in user.add
Diffstat (limited to 'lib/api/kolab_api_service_user.php')
-rw-r--r--lib/api/kolab_api_service_user.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index e6c4049..15378f8 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -21,13 +21,12 @@ class kolab_api_service_user extends kolab_api_service
public function user_add($getdata, $postdata)
{
- $uta = $this->user_type_attributes($postdata['user_type_id']);
-
+ $uta = $this->user_type_attributes($postdata['user_type_id']);
+ $form_service = $this->controller->get_service('form_value');
$user_attributes = array();
if (isset($uta['form_fields'])) {
foreach ($uta['form_fields'] as $key => $value) {
- error_log("form field $key");
if (!isset($postdata[$key]) || empty($postdata[$key])) {
throw new Exception("Missing input value for $key", 345);
}
@@ -39,12 +38,12 @@ class kolab_api_service_user extends kolab_api_service
if (isset($uta['auto_form_fields'])) {
foreach ($uta['auto_form_fields'] as $key => $value) {
- if (!isset($postdata[$key])) {
- throw new Exception("Key not set: " . $key, 12356);
- }
- else {
- $user_attributes[$key] = $postdata[$key];
+ if (empty($postdata[$key])) {
+ $method = 'generate_' . $key;
+ $res = $form_service->$method($getdata, $postdata);
+ $postdata[$key] = $res[$key];
}
+ $user_attributes[$key] = $postdata[$key];
}
}