From c815329681eb59e8313ea84746a8df082de307f5 Mon Sep 17 00:00:00 2001 From: AndrewPoppe Date: Wed, 25 Jan 2023 09:49:59 -0500 Subject: [PATCH] add option to restrict access to the logs for DAGs --- config.json | 15 +++++++++++++++ logging_table.php | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/config.json b/config.json index 29a8161..1817d9d 100644 --- a/config.json +++ b/config.json @@ -32,6 +32,21 @@ } ] }, + { + "key": "prevent_logs_for_dags", + "name": "Restrict Logging for DAG Users: Choose whether to disable the logging feature for users currently in a Data Access Group
Default setting is to restrict access", + "type": "dropdown", + "choices": [ + { + "value": 0, + "name": "Disable Logging access for users in a DAG" + }, + { + "value": 1, + "name": "Allow all users to see all logging" + } + ] + }, { "key": "restrict-access", "name": "Restrict User Access: Choose whether to restrict access to certain users in the project or to allow access to all users.
If you choose to restrict access, you will be able to select which individual users have access to this module.
Default is to allow all users to access the module", diff --git a/logging_table.php b/logging_table.php index 3ca1526..3c91ff5 100644 --- a/logging_table.php +++ b/logging_table.php @@ -2,6 +2,14 @@ $module->showPageHeader("logging_table"); $module->initializeJavascriptModuleObject(); +// If user is in a DAG and settings are appropriate, don't show the logging table. +$current_dag = $module->getCurrentDag($module->getProject()->getProjectId(), $module->getUser()->getUsername()); +$prevent_dags_from_seeing_logs = $module->getProjectSetting("prevent_logs_for_dags"); +if ($current_dag != null && $prevent_dags_from_seeing_logs != "1") { + echo "Since you have been assigned to a Data Access Group, you are not able to view the User Rights History logs.
"; + exit(); +} + // Get User's Date Format $date_format = \DateTimeRC::get_user_format_php(); $time_format = explode("_", \DateTimeRC::get_user_format_full(), 2)[1];