Skip to content
Snippets Groups Projects
Commit 6bccd443 authored by Peter Rotich's avatar Peter Rotich
Browse files

Add remote user

Support adding remote user to an organization
parent 591c37a5
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ class OrgsAjaxAPI extends AjaxController {
include(STAFFINC_DIR . 'templates/org-delete.tmpl.php');
}
function addUser($id, $userId=0) {
function addUser($id, $userId=0, $remote=false) {
global $thisstaff;
if (!$thisstaff)
......@@ -136,6 +136,13 @@ class OrgsAjaxAPI extends AjaxController {
elseif (!$info['error'])
$info['error'] = 'Unable to add user to the organization - try again';
} elseif ($remote && $userId) {
list($bk, $userId) = explode(':', $userId, 2);
if (!($backend = AuthenticationBackend::getSearchDirectoryBackend($bk))
|| !($user_info = $backend->lookup($userId)))
Http::response(404, 'User not found');
$form = UserForm::getUserForm()->getForm($user_info);
} elseif ($userId) //Selected local user
$user = User::lookup($userId);
......
......@@ -104,6 +104,7 @@ $dispatcher = patterns('',
url_get('^/select$', 'selectOrg'),
url_get('^/select/(?P<id>\d+)$', 'selectOrg'),
url_get('^/(?P<id>\d+)/add-user(?:/(?P<userid>\d+))?$', 'addUser'),
url_get('^/(?P<id>\d+)/add-user(?:/auth:(?P<userid>.+))?$', 'addUser', array(true)),
url_post('^/(?P<id>\d+)/add-user$', 'addUser'),
url_get('^/(?P<id>\d+)/delete$', 'delete'),
url_delete('^/(?P<id>\d+)/delete$', 'delete')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment