diff options
author | Francois Ferrand <thetypz@gmail.com> | 2015-01-16 17:08:48 +0100 |
---|---|---|
committer | Francois Ferrand <thetypz@gmail.com> | 2015-01-16 17:13:36 +0100 |
commit | 969d60ab416c075db27f7a0247f0c48ab519afa6 (patch) | |
tree | 5612bf783866291a24f7c5af913cbd584f7b7137 /jsonrpc.php | |
parent | fd22b955751075e4a69df9c1d24995f15b991be7 (diff) |
Add Json API to create LDAP user.
This allows setting up permissions before the LDAP users actually connect
to Kanboard, and even importing the permissions from other tools.
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( |