From 969d60ab416c075db27f7a0247f0c48ab519afa6 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Fri, 16 Jan 2015 17:08:48 +0100 Subject: 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. --- jsonrpc.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'jsonrpc.php') 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( -- cgit v1.2.3