diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-01-19 21:42:11 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-01-19 21:42:11 -0500 |
commit | 525d31d1bf485552330222049b630345814c9b44 (patch) | |
tree | 4f0ad2156e11f0e9e1db2691e4959faa4c472c1e /jsonrpc.php | |
parent | a5b6ac2b6a5277ec0bbb5ec73078330ed5043877 (diff) | |
parent | 969d60ab416c075db27f7a0247f0c48ab519afa6 (diff) |
Merge pull-request #524
Diffstat (limited to 'jsonrpc.php')
-rw-r--r-- | jsonrpc.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/jsonrpc.php b/jsonrpc.php index d0951e73..3de9de1b 100644 --- a/jsonrpc.php +++ b/jsonrpc.php @@ -157,6 +157,26 @@ $server->register('createUser', function($username, $password, $name = '', $emai return $container['user']->create($values); }); +$server->register('createLdapUser', function($username = '', $email = '', $is_admin = 0, $default_project_id = 0) use ($container) { + + $ldap = new Auth\Ldap($container); + $res = $ldap->lookup($username, $email); + + if (!$res) + return false; + + $values = array( + 'username' => $res['username'], + 'name' => $res['name'], + 'email' => $res['email'], + 'is_ldap_user' => 1, + 'is_admin' => $is_admin, + 'default_project_id' => $default_project_id, + ); + + return $container['user']->create($values); +}); + $server->register('updateUser', function($id, $username = null, $name = null, $email = null, $is_admin = null, $default_project_id = null) use ($container) { $values = array( |