From 10fafacefe7d68361fb0526c31f69ad76eba25db Mon Sep 17 00:00:00 2001 From: wrongecho Date: Fri, 20 Sep 2024 17:59:49 +0100 Subject: [PATCH 1/3] Custom Roles & Permissions Initial enforcement of custom roles & permissions - only on some pages via GET for now. --- accounts.php | 3 + admin_roles.php | 2 +- admin_side_nav.php | 6 + budget.php | 3 + check_login.php | 16 +- client_assets.php | 3 + client_certificates.php | 2 + client_documents.php | 2 + client_domains.php | 2 + client_invoices.php | 2 + client_logins.php | 3 + client_networks.php | 2 + client_payments.php | 2 + client_quotes.php | 2 + client_racks.php | 3 + client_recurring_invoices.php | 2 + client_recurring_tickets.php | 2 + client_services.php | 2 + client_side_nav.php | 401 +++++++++++++++++----------------- client_software.php | 2 + client_tickets.php | 3 + client_vendors.php | 2 + clients.php | 3 + expenses.php | 3 + functions.php | 8 +- inc_all_admin.php | 4 +- inc_all_client.php | 3 + inc_all_reports.php | 3 + invoices.php | 3 + payments.php | 2 + products.php | 3 + projects.php | 3 + quotes.php | 2 + recurring_expenses.php | 2 + recurring_invoices.php | 3 + recurring_tickets.php | 3 + report_assets.php | 3 +- reports_side_nav.php | 178 ++++++++------- revenues.php | 2 + side_nav.php | 110 +++++----- ticket.php | 3 + tickets.php | 3 + transfers.php | 3 + 43 files changed, 469 insertions(+), 345 deletions(-) diff --git a/accounts.php b/accounts.php index 9703d683..ff6cb037 100644 --- a/accounts.php +++ b/accounts.php @@ -6,6 +6,9 @@ $order = "ASC"; require_once "inc_all.php"; +// Perms +enforceUserPermission('module_financial'); + //Rebuild URL $url_query_strings_sort = http_build_query($get_copy); diff --git a/admin_roles.php b/admin_roles.php index 6a0e3f85..2a13b121 100644 --- a/admin_roles.php +++ b/admin_roles.php @@ -21,7 +21,7 @@ $sql = mysqli_query( $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?> -
Roles are not yet active/enforced - do not use.
+
Roles are still in development. Permissions may not be fully be enforced.
diff --git a/admin_side_nav.php b/admin_side_nav.php index 32c703bc..268e2d57 100644 --- a/admin_side_nav.php +++ b/admin_side_nav.php @@ -22,6 +22,12 @@

Users

+ + = 1) { ?> + - - + -

- - + +

+ + @@ -113,199 +112,207 @@ - + - + = 1) { ?> + - + - + - + - + - + 0) { ?> + + +

+ + - + 0) { ?> + + +

+ + - + - + + - + + - 2 && $config_module_enable_accounting == 1) { ?> + - + = 1) { ?> - + + - + - + + + = 1) { ?> + + - - - = 2 && $config_module_enable_ticketing == 1) { ?> - + = 1) { ?> - - + + = 1) { ?> + + + + + + + + - + = 1) { ?> - + = 1) { ?> - + + = 1) { ?> + + Date: Fri, 20 Sep 2024 18:09:00 +0100 Subject: [PATCH 2/3] Custom Roles & Permissions Initial enforcement of custom roles & permissions - only on some pages via GET for now. --- admin_roles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin_roles.php b/admin_roles.php index 2a13b121..d332b52e 100644 --- a/admin_roles.php +++ b/admin_roles.php @@ -21,7 +21,7 @@ $sql = mysqli_query( $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?> -
Roles are still in development. Permissions may not be fully be enforced.
+
Roles are still in development. Permissions may not be fully enforced.
From 3d1e333ff074deb32317039185139c1b4cbeada0 Mon Sep 17 00:00:00 2001 From: wrongecho Date: Fri, 20 Sep 2024 18:17:59 +0100 Subject: [PATCH 3/3] Custom Roles & Permissions Initial enforcement of custom roles & permissions - only on some pages via GET for now. --- check_login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_login.php b/check_login.php index d1be1ac3..73e52b26 100644 --- a/check_login.php +++ b/check_login.php @@ -40,7 +40,7 @@ $session_user_id = intval($_SESSION['user_id']); $sql = mysqli_query( $mysqli, - "SELECT * FROM USERS + "SELECT * FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id LEFT JOIN user_roles ON user_settings.user_role = user_roles.user_role_id WHERE users.user_id = $session_user_id"