mirror of
https://github.com/itflow-org/itflow
synced 2026-11-21 20:07:24 +00:00
Users: an API or service account keeps its role for API keys but is left out of agent lists, pickers, notifications and admin alerts, cannot sign in, and has its own API accounts tab on Admin Users; database 3.8.1 adds users.user_service_account; 26.11.9 changelog entries
This commit is contained in:
@@ -129,7 +129,7 @@ $portal_client_ids = !empty($t['ticket_template_id']) ? ticketTemplatePortalClie
|
||||
<select class="form-select select2" name="assigned_to">
|
||||
<option value="0">- Leave as it is -</option>
|
||||
<?php
|
||||
$sql_agents = mysqli_query($mysqli, "SELECT user_id, user_name, user_avatar FROM users WHERE user_type = 1 AND user_status = 1 AND (user_archived_at IS NULL OR user_id = $assigned_to) ORDER BY user_name ASC");
|
||||
$sql_agents = mysqli_query($mysqli, "SELECT user_id, user_name, user_avatar FROM users WHERE user_type = 1" . serviceAccountsOutSql() . " AND user_status = 1 AND (user_archived_at IS NULL OR user_id = $assigned_to) ORDER BY user_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_agents)) { ?>
|
||||
<option value="<?= intval($row['user_id']) ?>" <?= intval($row['user_id']) === $assigned_to ? 'selected' : '' ?><?= selectOptionUser($row['user_id'], $row['user_name'], $row['user_avatar'] ?? '') ?>><?= escapeHtml($row['user_name']) ?></option>
|
||||
<?php } ?>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
require_once '../../includes/modal_header.php';
|
||||
|
||||
$agent_count = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM users WHERE user_type = 1 AND user_archived_at IS NULL AND user_id <> " . intval($session_user_id)))[0]);
|
||||
$agent_count = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM users WHERE user_type = 1" . serviceAccountsOutSql() . " AND user_archived_at IS NULL AND user_id <> " . intval($session_user_id)))[0]);
|
||||
|
||||
ob_start();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ $is_last_admin = userIsLastAdmin($user);
|
||||
// Who can take their work - active agents, not them
|
||||
$agents = [];
|
||||
$sql = mysqli_query($mysqli, "SELECT user_id, user_name, user_avatar FROM users
|
||||
WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL AND user_id <> $user_id ORDER BY user_name ASC");
|
||||
WHERE user_type = 1" . serviceAccountsOutSql() . " AND user_status = 1 AND user_archived_at IS NULL AND user_id <> $user_id ORDER BY user_name ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$agents[] = $row;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,24 @@ $value = function ($key) use ($form) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (serviceAccountsReady()) {
|
||||
$form_service = $form_user_id && serviceAccountIs($form_user_id); ?>
|
||||
<!-- A login only for API keys to act as (functions/service_account.php) -->
|
||||
<div class="col-12" data-user-service-account>
|
||||
<input type="hidden" name="service_account_present" value="1">
|
||||
<div class="border rounded p-3">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" name="service_account" value="1" id="<?= $form_id ?>ServiceAccount" <?= $form_service ? 'checked' : '' ?>>
|
||||
<label class="form-check-label fw-semibold" for="<?= $form_id ?>ServiceAccount"><i class="fas fa-fw fa-plug text-body-secondary me-1"></i>API / service account</label>
|
||||
<div class="form-text mt-0">
|
||||
For a login that API keys act as, for an integration. It keeps its role, so its keys work, but it's left out of the calendar, every assign picker, the reports and the other agent lists, gets no notifications, and can't sign in to ITFlow.
|
||||
<?= $is_new ? 'Set a password for it - it isn\'t invited.' : '' ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user