From 2795b4e15e101884b89ae481051355bbd64ed7b8 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 20 Feb 2025 14:58:25 -0500 Subject: [PATCH] Added Global Views for Licenses, Credentials and Certificates --- client_certificates.php => certificates.php | 42 ++++-- contacts.php | 4 +- client_logins.php => credentials.php | 125 +++++++++++++----- domains.php | 4 +- global_search.php | 71 +++++----- includes/client_overview_side_nav.php | 18 +++ includes/client_side_nav.php | 6 +- ...ia_id.js => credential_show_otp_via_id.js} | 0 ...erate_password.js => generate_password.js} | 0 ...dd_modal.php => certificate_add_modal.php} | 0 ...modal.php => certificate_export_modal.php} | 4 +- ...add_modal.php => credential_add_modal.php} | 32 ++++- ... => credential_bulk_assign_tags_modal.php} | 0 ..._modal.php => credential_export_modal.php} | 4 +- ..._modal.php => credential_import_modal.php} | 6 +- ...p => software_add_from_template_modal.php} | 0 ...e_add_modal.php => software_add_modal.php} | 34 ++++- ...rt_modal.php => software_export_modal.php} | 0 post/user/certificate.php | 21 ++- post/user/credential.php | 32 ++--- post/user/trip.php | 2 +- client_software.php => software.php | 43 ++++-- 22 files changed, 322 insertions(+), 126 deletions(-) rename client_certificates.php => certificates.php (86%) rename client_logins.php => credentials.php (84%) rename js/{logins_show_otp_via_id.js => credential_show_otp_via_id.js} (100%) rename js/{logins_generate_password.js => generate_password.js} (100%) rename modals/{client_certificate_add_modal.php => certificate_add_modal.php} (100%) rename modals/{client_certificate_export_modal.php => certificate_export_modal.php} (79%) rename modals/{client_login_add_modal.php => credential_add_modal.php} (89%) rename modals/{client_login_bulk_assign_tags_modal.php => credential_bulk_assign_tags_modal.php} (100%) rename modals/{client_login_export_modal.php => credential_export_modal.php} (79%) rename modals/{client_login_import_modal.php => credential_import_modal.php} (82%) rename modals/{client_software_add_from_template_modal.php => software_add_from_template_modal.php} (100%) rename modals/{client_software_add_modal.php => software_add_modal.php} (86%) rename modals/{client_software_export_modal.php => software_export_modal.php} (100%) rename client_software.php => software.php (88%) diff --git a/client_certificates.php b/certificates.php similarity index 86% rename from client_certificates.php rename to certificates.php index 3f874e37..430ae5c0 100644 --- a/client_certificates.php +++ b/certificates.php @@ -4,7 +4,16 @@ $sort = "certificate_name"; $order = "ASC"; -require_once "includes/inc_all_client.php"; +// If client_id is in URI then show client Side Bar and client header +if (isset($_GET['client_id'])) { + require_once "includes/inc_all_client.php"; + $client_query = "AND certificate_client_id = $client_id"; + $client_url = "client_id=$client_id&"; +} else { + require_once "includes/inc_client_overview_all.php"; + $client_query = ''; + $client_url = ''; +} // Perms enforceUserPermission('module_support'); @@ -12,11 +21,13 @@ enforceUserPermission('module_support'); //Rebuild URL $url_query_strings_sort = http_build_query($get_copy); -$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates - WHERE certificate_archived_at IS NULL - AND certificate_client_id = $client_id - AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%') - ORDER BY $sort $order LIMIT $record_from, $record_to"); +$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates + LEFT JOIN clients ON client_id = certificate_client_id + WHERE certificate_archived_at IS NULL + AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%' OR client_name LIKE '%$q%') + $client_query + ORDER BY $sort $order LIMIT $record_from, $record_to" +); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -41,7 +52,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ +
@@ -105,6 +118,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Expire + + + + Client + + + Action @@ -112,6 +132,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + + + diff --git a/contacts.php b/contacts.php index 1baf2383..607268e6 100644 --- a/contacts.php +++ b/contacts.php @@ -66,7 +66,7 @@ $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS contacts.*, clients.*, LEFT JOIN tags ON tags.tag_id = contact_tags.tag_id WHERE contact_$archive_query $tag_query - AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%' OR tag_name LIKE '%$q%') + AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%' OR tag_name LIKE '%$q%' OR client_name LIKE '%$q%') $client_query $location_query GROUP BY contact_id @@ -263,7 +263,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Location - + Client diff --git a/client_logins.php b/credentials.php similarity index 84% rename from client_logins.php rename to credentials.php index f7eaa029..dae96154 100644 --- a/client_logins.php +++ b/credentials.php @@ -4,14 +4,24 @@ $sort = "login_name"; $order = "ASC"; -require_once "includes/inc_all_client.php"; +// If client_id is in URI then show client Side Bar and client header +if (isset($_GET['client_id'])) { + require_once "includes/inc_all_client.php"; + $client_query = "AND login_client_id = $client_id"; + $client_url = "client_id=$client_id&"; + // Log when users load the Credentials/Logins page + logAction("Credential", "View", "$session_name viewed the Credentials page for client", $client_id); +} else { + require_once "includes/inc_client_overview_all.php"; + $client_query = ''; + $client_url = ''; + // Log when users load the Credentials/Logins page + logAction("Credential", "View", "$session_name viewed the All Credentials page"); +} // Perms enforceUserPermission('module_credential'); -// Log when users load the Credentials/Logins page -mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Credential', log_action = 'View', log_description = '$session_name viewed the Credentials page for client', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id"); - // Tags Filter if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) { // Sanitize each element of the status array @@ -28,34 +38,46 @@ if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) { $tag_query = ''; } -// Location Filter -if (isset($_GET['location']) & !empty($_GET['location'])) { - $location_query = 'AND (a.asset_location_id = ' . intval($_GET['location']) . ')'; - $location_query_innerjoin = 'INNER JOIN assets a on a.asset_id = l.login_asset_id '; - $location_filter = intval($_GET['location']); -} else { - // Default - any - $location_query_innerjoin = ''; - $location_query = ''; - $location_filter = ''; +if (!$client_url) { + // Client Filter + if (isset($_GET['client']) & !empty($_GET['client'])) { + $client_query = 'AND (login_client_id = ' . intval($_GET['client']) . ')'; + $client = intval($_GET['client']); + } else { + // Default - any + $client_query = ''; + $client = ''; + } } - -//Rebuild URL -$url_query_strings_sort = http_build_query($get_copy); +if ($client_url) { + // Location Filter + if (isset($_GET['location']) & !empty($_GET['location'])) { + $location_query = 'AND (a.asset_location_id = ' . intval($_GET['location']) . ')'; + $location_query_innerjoin = 'INNER JOIN assets a on a.asset_id = l.login_asset_id '; + $location_filter = intval($_GET['location']); + } else { + // Default - any + $location_query_innerjoin = ''; + $location_query = ''; + $location_filter = ''; + } +} $sql = mysqli_query( $mysqli, - "SELECT SQL_CALC_FOUND_ROWS l.login_id AS l_login_id, l.*, login_tags.*, tags.* + "SELECT SQL_CALC_FOUND_ROWS l.login_id AS l_login_id, l.*, login_tags.*, tags.*, clients.* FROM logins l LEFT JOIN login_tags ON login_tags.login_id = l.login_id LEFT JOIN tags ON tags.tag_id = login_tags.tag_id + LEFT JOIN clients ON client_id = login_client_id $location_query_innerjoin - WHERE l.login_client_id = $client_id + WHERE l.login_$archive_query $tag_query - AND l.login_$archive_query - AND (l.login_name LIKE '%$q%' OR l.login_description LIKE '%$q%' OR l.login_uri LIKE '%$q%' OR tag_name LIKE '%$q%') + AND (l.login_name LIKE '%$q%' OR l.login_description LIKE '%$q%' OR l.login_uri LIKE '%$q%' OR tag_name LIKE '%$q%' OR client_name LIKE '%$q%') $location_query + $client_query + GROUP BY l.login_id ORDER BY l.login_important DESC, $sort $order LIMIT $record_from, $record_to" ); @@ -91,7 +113,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ +
@@ -102,7 +126,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + +
+ +
+
+ +
+
+
@@ -141,7 +187,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- "> Archived @@ -204,6 +250,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + + + + Client + + + Action @@ -211,6 +264,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - +
@@ -336,6 +395,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
+ +
+
@@ -366,7 +428,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + data-ajax-id="" + > Edit @@ -406,7 +469,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + @@ -414,15 +477,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + - +
+ +
diff --git a/global_search.php b/global_search.php index be3c1693..a7130489 100644 --- a/global_search.php +++ b/global_search.php @@ -141,22 +141,22 @@ if (isset($_GET['query'])) { ?> - -
-
-

Global Search

-
+
+
+

Global Search

+
+
0) { ?>
-
+
-
Clients
+
Clients
@@ -196,9 +196,9 @@ if (isset($_GET['query'])) {
-
+
-
Contacts
+
Contacts
@@ -252,9 +252,9 @@ if (isset($_GET['query'])) {
-
+
-
Vendors
+
Vendors
@@ -299,9 +299,9 @@ if (isset($_GET['query'])) {
-
+
-
Domains
+
Domains
@@ -343,9 +343,9 @@ if (isset($_GET['query'])) {
-
+
-
Products
+
Products
@@ -382,9 +382,9 @@ if (isset($_GET['query'])) {
-
+
-
Documents
+
Documents
@@ -426,9 +426,9 @@ if (isset($_GET['query'])) {
-
+
-
Files
+
Files
@@ -476,9 +476,9 @@ if (isset($_GET['query'])) {
-
+
-
Tickets
+
Tickets
@@ -526,9 +526,9 @@ if (isset($_GET['query'])) {
-
+
-
Recurring Tickets
+
Recurring Tickets
@@ -575,9 +575,9 @@ if (isset($_GET['query'])) {
-
+
-
Credentials
+

Credentials

@@ -604,12 +604,12 @@ if (isset($_GET['query'])) { ?> - + - + @@ -628,9 +628,9 @@ if (isset($_GET['query'])) {
-
+
-
Invoices
+
Invoices
@@ -679,9 +679,9 @@ if (isset($_GET['query'])) {
-
+
-
Assets
+
Assets
@@ -771,9 +771,9 @@ if (isset($_GET['query'])) {
-
+
-
Ticket Replies
+
Ticket Replies
@@ -838,11 +838,16 @@ if (isset($_GET['query'])) {
+
+ + + + ALL Domains

+ + + diff --git a/includes/client_side_nav.php b/includes/client_side_nav.php index 2667e168..a24a83a8 100644 --- a/includes/client_side_nav.php +++ b/includes/client_side_nav.php @@ -129,7 +129,7 @@ + + @@ -30,6 +31,33 @@
+ + + + +
+ +
+
+ +
+ +
+
+ + +
@@ -116,6 +144,7 @@
+
@@ -222,6 +251,7 @@
+
diff --git a/modals/client_login_bulk_assign_tags_modal.php b/modals/credential_bulk_assign_tags_modal.php similarity index 100% rename from modals/client_login_bulk_assign_tags_modal.php rename to modals/credential_bulk_assign_tags_modal.php diff --git a/modals/client_login_export_modal.php b/modals/credential_export_modal.php similarity index 79% rename from modals/client_login_export_modal.php rename to modals/credential_export_modal.php index 13bb0a7e..4dbeb453 100644 --- a/modals/client_login_export_modal.php +++ b/modals/credential_export_modal.php @@ -8,12 +8,14 @@
+ + diff --git a/modals/client_login_import_modal.php b/modals/credential_import_modal.php similarity index 82% rename from modals/client_login_import_modal.php rename to modals/credential_import_modal.php index 566ccdda..cdbbe15c 100644 --- a/modals/client_login_import_modal.php +++ b/modals/credential_import_modal.php @@ -8,7 +8,9 @@
+ +
- +
diff --git a/modals/client_software_add_from_template_modal.php b/modals/software_add_from_template_modal.php similarity index 100% rename from modals/client_software_add_from_template_modal.php rename to modals/software_add_from_template_modal.php diff --git a/modals/client_software_add_modal.php b/modals/software_add_modal.php similarity index 86% rename from modals/client_software_add_modal.php rename to modals/software_add_modal.php index b8eb8a66..8dc810c2 100644 --- a/modals/client_software_add_modal.php +++ b/modals/software_add_modal.php @@ -8,7 +8,6 @@ - + @@ -111,6 +127,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + + +
+ + Client + + Action