Skip to content
Snippets Groups Projects
Commit 7a6e69bf authored by Jared Hancock's avatar Jared Hancock
Browse files

Allow addition of collaborator from auth backend

parent 7f22ad0d
No related branches found
No related tags found
No related merge requests found
...@@ -449,6 +449,26 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -449,6 +449,26 @@ class TicketsAjaxAPI extends AjaxController {
return $resp; return $resp;
} }
function addRemoteCollaborator($tid, $bk, $id) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffAccess($thisstaff))
Http::response(404, 'No such ticket');
elseif (!$bk || !$id)
Http::response(422, 'Backend and user id required');
elseif (!($backend = AuthenticationBackend::getBackend($bk)))
Http::response(404, 'User not found');
$user_info = $backend->lookup($id);
$form = UserForm::getUserForm()->getForm($user_info);
$info = array();
if (!$user_info)
$info['error'] = 'Unable to find user in directory';
return self::_addcollaborator($ticket, null, $form, $info);
}
//Collaborators utils //Collaborators utils
function addCollaborator($tid, $uid=0) { function addCollaborator($tid, $uid=0) {
global $thisstaff; global $thisstaff;
......
...@@ -82,6 +82,7 @@ $dispatcher = patterns('', ...@@ -82,6 +82,7 @@ $dispatcher = patterns('',
url_get('^(?P<tid>\d+)/collaborators/manage$', 'showCollaborators'), url_get('^(?P<tid>\d+)/collaborators/manage$', 'showCollaborators'),
url_post('^(?P<tid>\d+)/collaborators$', 'updateCollaborators'), url_post('^(?P<tid>\d+)/collaborators$', 'updateCollaborators'),
url_get('^(?P<tid>\d+)/add-collaborator/(?P<uid>\d+)$', 'addCollaborator'), url_get('^(?P<tid>\d+)/add-collaborator/(?P<uid>\d+)$', 'addCollaborator'),
url_get('^(?P<tid>\d+)/add-collaborator/auth:(?P<bk>\w+):(?P<id>.+)$', 'addRemoteCollaborator'),
url('^(?P<tid>\d+)/add-collaborator$', 'addCollaborator'), url('^(?P<tid>\d+)/add-collaborator$', 'addCollaborator'),
url_get('^lookup', 'lookup'), url_get('^lookup', 'lookup'),
url_get('^search', 'search') url_get('^search', 'search')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment