I create issues from a corporate site with JIRA REST API.
Creating everything under the administrator or agent, everything works. But creating a normal user (LDAP), there is a problem.
LDAP is configured correctly. Users in the system are working. Can there be a problem with access rights or system settings? I think I set everything right. Where to look?
<span><div id="wrapper"></span>
<span><h1></span>Create Issue<span></h1></span>
<span><form id="create-form"></span>
Summary: <span><input type="text" name="summary" id="summary" value=""/></span>
Description: <span><input type="text" name="description" id="description" value="" /></span>
Issue Type: <span><input type="text" name="type" id="type" value=""/></span>
Username: <span><input type="text" name="user" id="user" value=""/></span>
Password: <span><input type="password" name="pass" id="pass" value=""/></span>
<span><input type="button" id="button" value="Create Issue"/></span>
<span></form></span>
<span></div></span>
<span><script></span><span>$('#button').click(function() {
$.ajax({
type: "POST",
url: "jiraapi.php",
data: $('#create-form').serialize(),
success: function(data){
alert(data);
},
dataType: "html"
});
});</span><span></script></span>/**
<span><?php</span>
$base64_usrpwd = base64_encode($_POST[<span>'user'</span>].<span>':'</span>.$_POST[<span>'pass'</span>]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, <span>'http://localhost:8080/rest/api/2/issue/'</span>);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, <span>true</span>);
curl_setopt($ch, CURLOPT_POST, <span>1</span>);
curl_setopt($ch, CURLOPT_HTTPHEADER, <span>array</span>(<span>'Content-Type: application/json'</span>,
<span>'Authorization: Basic '</span>.$base64_usrpwd));
$arr[<span>'project'</span>] = <span>array</span>( <span>'key'</span> => <span>'TP'</span>);
$arr[<span>'summary'</span>] = $_POST[<span>'summary'</span>];
$arr[<span>'description'</span>] = $_POST[<span>'description'</span>];
$arr[<span>'issuetype'</span>] = <span>array</span>( <span>'name'</span> => $_POST[<span>'type'</span>]);
$json_arr[<span>'fields'</span>] = $arr;
$json_string = json_encode ($json_arr);
curl_setopt($ch, CURLOPT_POSTFIELDS,$json_string);
$result = curl_exec($ch);
curl_close($ch);
<span>echo</span> $result;
<span>?></span>Under the administrator I get an alert with the data and the issue is created.
Under LDAP users, the response is empty, issue is not created, alert comes empty.
If login / password is not valid, then displays error 401