Add test if module enabled before showing API information
This commit is contained in:
parent
190ee35e86
commit
3bf1b60be8
@ -83,6 +83,7 @@ if ($user->id <> $id && ! $canreaduser) accessforbidden();
|
|||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("ldap");
|
$langs->load("ldap");
|
||||||
|
$langs->load("admin");
|
||||||
|
|
||||||
$object = new User($db);
|
$object = new User($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
@ -824,6 +825,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if(! empty($conf->api->enabled)) {
|
||||||
// API key
|
// API key
|
||||||
$generated_api_key = '';
|
$generated_api_key = '';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||||
@ -878,6 +880,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
|
|||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td>';
|
print '<tr><td>'.$langs->trans("Type").'</td>';
|
||||||
@ -1270,7 +1273,7 @@ else
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
// API key
|
// API key
|
||||||
if($user->admin) {
|
if(! empty($conf->api->enabled) && $user->admin) {
|
||||||
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
if (! empty($object->api_key))
|
if (! empty($object->api_key))
|
||||||
@ -1849,7 +1852,7 @@ else
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
// API key
|
// API key
|
||||||
if($user->admin) {
|
if(! empty($conf->api->enabled) && $user->admin) {
|
||||||
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input size="30" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
|
print '<input size="30" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
|
||||||
@ -2230,7 +2233,7 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print "\n".'<script type="text/javascript">';
|
print "\n".'<script type="text/javascript">';
|
||||||
print '$(document).ready(function () {
|
print '$(document).ready(function () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user