From f91b900526c2146e03bf2f12cb2dd39efefc66a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:47:32 -0500 Subject: [PATCH 01/14] Refactor authorization logic in admin_view.php Simplified authorization checks for report access by removing redundant site admin checks. --- admin_view.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/admin_view.php b/admin_view.php index 2f0e1aa..3cd1d26 100644 --- a/admin_view.php +++ b/admin_view.php @@ -33,7 +33,7 @@ } // Friendly redirect for unauthorized users -if (!has_capability('block/personality_test:viewreports', $context) && !is_siteadmin()) { +if (!has_capability('block/personality_test:viewreports', $context)) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } @@ -53,11 +53,8 @@ if ($confirm) { // Privacy check $targetuser = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST); - if (!is_siteadmin() && ( - !is_enrolled($context, $targetuser, 'block/personality_test:taketest', true) - || has_capability('block/personality_test:viewreports', $context, $userid) - || is_siteadmin($userid) - )) { + if (!is_enrolled($context, $targetuser, 'block/personality_test:taketest', true) + || has_capability('block/personality_test:viewreports', $context, $userid)) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } From 2a38892f1be6f8f18e97fa6fd5ff1e072c830c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:48:58 -0500 Subject: [PATCH 02/14] Remove site admin check from student filtering logic --- block_personality_test.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/block_personality_test.php b/block_personality_test.php index 08e4534..9489d2d 100644 --- a/block_personality_test.php +++ b/block_personality_test.php @@ -99,9 +99,6 @@ private function _get_teacher_content($DB, $COURSE) { $filtered_student_ids = array(); foreach ($student_ids as $candidateid) { $candidateid = (int)$candidateid; - if (is_siteadmin($candidateid)) { - continue; - } if (has_capability('block/personality_test:viewreports', $context, $candidateid)) { continue; } From ea8426784552111993d7509e1cd21b02a5e3609b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:49:15 -0500 Subject: [PATCH 03/14] Simplify report view permissions check Removed site admin check from report view permissions. --- lib.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib.php b/lib.php index 55ab867..f6177fd 100644 --- a/lib.php +++ b/lib.php @@ -77,7 +77,7 @@ function block_personality_test_get_report_data($courseid) { require_login($course, false); // Check permissions - if (!has_capability('block/personality_test:viewreports', $context) && !is_siteadmin()) { + if (!has_capability('block/personality_test:viewreports', $context)) { return false; } @@ -89,9 +89,6 @@ function block_personality_test_get_report_data($courseid) { $student_ids = array(); foreach ($enrolled_ids as $candidateid) { $candidateid = (int)$candidateid; - if (is_siteadmin($candidateid)) { - continue; - } if (has_capability('block/personality_test:viewreports', $context, $candidateid)) { continue; } From 9f3c63e41555b67839640d3e7d398df9b795628c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:49:31 -0500 Subject: [PATCH 04/14] Refine report view capability check Remove site admin check from report view capability. --- download_pdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download_pdf.php b/download_pdf.php index 0728d8f..6876b68 100644 --- a/download_pdf.php +++ b/download_pdf.php @@ -44,7 +44,7 @@ $context = context_course::instance($course->id); require_login($course, false); - $canviewreports = has_capability('block/personality_test:viewreports', $context) || is_siteadmin(); + $canviewreports = has_capability('block/personality_test:viewreports', $context); if (!$canviewreports && (int)$userid !== (int)$USER->id) { redirect(new moodle_url('/course/view.php', ['id' => $course->id])); } From 968a734f8a5303a72fbb54b6b43db539b7ffbf90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:50:22 -0500 Subject: [PATCH 05/14] Simplify report access checks in view_individual.php Refactor access checks to streamline report viewing logic. --- view_individual.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/view_individual.php b/view_individual.php index be6efb0..87762cf 100644 --- a/view_individual.php +++ b/view_individual.php @@ -22,16 +22,15 @@ // Verificar permisos y manejo de privacidad $is_own_results = ($USER->id == $userid); $can_view_reports = has_capability('block/personality_test:viewreports', $context); -$is_siteadmin = is_siteadmin($USER); // Acceso básico: Si no es propietario, ni profesor (con permisos), ni admin -> Redirigir -if (!$is_own_results && !$can_view_reports && !$is_siteadmin) { +if (!$is_own_results && !$can_view_reports) { redirect(new moodle_url('/course/view.php', array('id' => $courseid))); } // Check if teacher can access this specific user info (Grouping check) // Si no es admin y no son sus propios resultados... -if (!$is_siteadmin && !$is_own_results) { +if (!$is_own_results) { // Si el usuario tiene la capacidad de ver todos los grupos, permitir. if (!has_capability('moodle/site:accessallgroups', $context)) { // Obtener grupos del profesor y del estudiante objetivo From a534b5c8845a2bbe8bbe043b14bf2982fea14ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:51:25 -0500 Subject: [PATCH 06/14] Update CHANGELOG for version 2.0.4 Removed redundant admin checks in key views to improve role detection and permissions system. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f4184f..2f29131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ Todas las modificaciones importantes del proyecto se documentarán en este archivo. +## [2.0.4] - 2026-01-18 +- Se eliminaron las comprobaciones redundantes de administrador (`is_siteadmin()`) en varias vistas clave, mejorando la detección correcta de roles locales (profesores vs estudiantes) y el sistema de permisos basado en capacidades. + ## [2.0.3] — 2026-01-18 - Opción para mostrar/ocultar las descripciones en el bloque principal. - Adición del gráfico radar en resultados detallados y acceso permitido a los estudiantes a esta vista. From aa9d43da6913d02f5adcd001e13d8954ad5bfdc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 12:51:49 -0500 Subject: [PATCH 07/14] Bump version to 2.0.4 and update release notes --- version.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.php b/version.php index af28399..3c5f59d 100644 --- a/version.php +++ b/version.php @@ -1,7 +1,7 @@ version = 2026011800; // YYYYMMDDXX (year, month, day, 2-digit version number). +$plugin->version = 2026011801; // YYYYMMDDXX (year, month, day, 2-digit version number). $plugin->requires = 2022041900; // Moodle 4.0+ $plugin->component = 'block_personality_test'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '2.0.3'; +$plugin->release = '2.0.4'; From 2e3c28e6abe8c0684b2b49e89df437decd7d3e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 20:32:12 -0500 Subject: [PATCH 08/14] Make header text bold in personality invitation block --- templates/student_continue.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/student_continue.mustache b/templates/student_continue.mustache index 89de0ce..430e0de 100644 --- a/templates/student_continue.mustache +++ b/templates/student_continue.mustache @@ -1,7 +1,7 @@
{{{icon}}} -
{{#str}}test_title, block_personality_test{{/str}}
+
{{#str}}test_title, block_personality_test{{/str}}
{{#str}}discover_your_personality, block_personality_test{{/str}}
From e046e8467ec6c1c41c56b76f6f2b391f790fba5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 20:32:21 -0500 Subject: [PATCH 09/14] Make title bold in student invitation template --- templates/student_invitation.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/student_invitation.mustache b/templates/student_invitation.mustache index d12967a..82a94da 100644 --- a/templates/student_invitation.mustache +++ b/templates/student_invitation.mustache @@ -1,7 +1,7 @@
{{{icon}}} -
{{#str}}test_title, block_personality_test{{/str}}
+
{{#str}}test_title, block_personality_test{{/str}}
{{#str}}discover_your_personality, block_personality_test{{/str}}
From f19e9d1915d3696850f9f2a718f9aed625744bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 20:32:38 -0500 Subject: [PATCH 10/14] Make test_completed heading bold in student results --- templates/student_results.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/student_results.mustache b/templates/student_results.mustache index 374b8fe..79aa816 100644 --- a/templates/student_results.mustache +++ b/templates/student_results.mustache @@ -4,7 +4,7 @@ {{{icon}}}
-
{{#str}}test_completed, block_personality_test{{/str}}
+
{{#str}}test_completed, block_personality_test{{/str}}
{{#str}}your_results_here, block_personality_test{{/str}}
From d45093e8af0e26068496247b8cebf4cde7c38dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 20:33:02 -0500 Subject: [PATCH 11/14] Update CHANGELOG for version 2.0.4 changes Removed redundant admin checks in key views to improve role detection and permissions system. Added bold formatting to block title for better visibility. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f29131..302cc11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Todas las modificaciones importantes del proyecto se documentarán en este archi ## [2.0.4] - 2026-01-18 - Se eliminaron las comprobaciones redundantes de administrador (`is_siteadmin()`) en varias vistas clave, mejorando la detección correcta de roles locales (profesores vs estudiantes) y el sistema de permisos basado en capacidades. +- Se agrega negrilla en el titulo del bloque para mejorar la visibilidad. ## [2.0.3] — 2026-01-18 - Opción para mostrar/ocultar las descripciones en el bloque principal. From feff21e54f20b24a11a3f2aaefc2776e7fb95fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 21:38:13 -0500 Subject: [PATCH 12/14] Change test title to 'Personality Exploration' --- lang/en/block_personality_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en/block_personality_test.php b/lang/en/block_personality_test.php index 9b9394d..858589f 100644 --- a/lang/en/block_personality_test.php +++ b/lang/en/block_personality_test.php @@ -265,7 +265,7 @@ $string['mbti_dimensions_entj'] = 'Extraversion - Intuition - Thinking - Judging'; // Test invitation -$string['test_title'] = 'Personality '; +$string['test_title'] = 'Personality Exploration'; $string['discover_your_personality'] = 'Discover your personality type'; $string['what_is_mbti'] = 'What is the Myers-Briggs Type Indicator (MBTI)?'; $string['test_description'] = 'A self-reflective tool designed to reveal your natural preferences across four fundamental dimensions. Its goal is to provide you with a detailed profile of your strengths, blind spots, and how you interact with the world and the people around you.'; From 74a9afdd2e5b7bba1fe8fa2c90752542ca488876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20valentina=20serna=20Gonz=C3=A1lez?= <162528525+serna0120@users.noreply.github.com> Date: Sun, 18 Jan 2026 21:45:25 -0500 Subject: [PATCH 13/14] Update image links in README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b4b8319..b6fb66d 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Este repositorio incluye: El recorrido comienza con una invitación clara y directa. Desde el bloque principal del curso, el estudiante puede visualizar su estado actual y acceder al test con un solo click, facilitando la participación sin fricciones.

- Invitación al Test + Invitación al Test

**Interfaz de Evaluación Optimizada** @@ -74,7 +74,7 @@ Para garantizar la integridad de los datos, el sistema implementa una validació Entendemos que el tiempo es valioso. Si el estudiante debe interrumpir su sesión, el sistema guarda automáticamente su avance. Al regresar, el bloque muestra el porcentaje de progreso y permite reanudar el test exactamente donde se dejó, resaltando visualmente la siguiente pregunta a responder.

- Progreso del Test + Progreso del Test    Continuar Test

@@ -83,7 +83,7 @@ Entendemos que el tiempo es valioso. Si el estudiante debe interrumpir su sesió Si el estudiante ha completado las 44 preguntas pero aún no ha procesado el envío, el bloque muestra una notificación clara y amigable, invitándolo a formalizar la entrega y conocer su tipo de personalidad.

- Confirmación de Test Completado + Confirmación de Test Completado

**Análisis de Perfil y Recomendaciones Personalizadas** From e38a212811df124c79a0b618c5718e345bb01043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20David=20S=C3=A1nchez=20S=C3=A1nchez?= <158796340+IsaacDev2024@users.noreply.github.com> Date: Sun, 18 Jan 2026 22:10:48 -0500 Subject: [PATCH 14/14] Change icon from chart to eye in student results template --- templates/student_results.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/student_results.mustache b/templates/student_results.mustache index 79aa816..be5e8f0 100644 --- a/templates/student_results.mustache +++ b/templates/student_results.mustache @@ -32,7 +32,7 @@
- {{#str}} see_detailed_results, block_personality_test {{/str}} + {{#str}} see_detailed_results, block_personality_test {{/str}}