diff --git a/reports/security/Security-Audit-OWASP-Top-10-Results-localhost-API-02122024.pdf b/reports/security/Security-Audit-OWASP-Top-10-Results-localhost-API-02122024.pdf index 80d5e82e..37c91f89 100755 Binary files a/reports/security/Security-Audit-OWASP-Top-10-Results-localhost-API-02122024.pdf and b/reports/security/Security-Audit-OWASP-Top-10-Results-localhost-API-02122024.pdf differ diff --git a/src/assets/screenshots/ports.png b/src/assets/screenshots/ports.png new file mode 100644 index 00000000..e73df3f3 Binary files /dev/null and b/src/assets/screenshots/ports.png differ diff --git a/src/assets/screenshots/repos.png b/src/assets/screenshots/repos.png new file mode 100644 index 00000000..c932828a Binary files /dev/null and b/src/assets/screenshots/repos.png differ diff --git a/src/assets/screenshots/unauthorised-result.png b/src/assets/screenshots/unauthorised-result.png new file mode 100644 index 00000000..26f2398c Binary files /dev/null and b/src/assets/screenshots/unauthorised-result.png differ diff --git a/src/assets/screenshots/unauthorised.png b/src/assets/screenshots/unauthorised.png new file mode 100644 index 00000000..a19b44fd Binary files /dev/null and b/src/assets/screenshots/unauthorised.png differ diff --git a/src/pages/admin-access-control.md b/src/pages/admin-access-control.md new file mode 100644 index 00000000..591c3b19 --- /dev/null +++ b/src/pages/admin-access-control.md @@ -0,0 +1,60 @@ +--- +title: Admin Access Control +layout: ../layouts/BaseLayout.astro +--- + +# Admin Access Control Implementation + +## Overview +This documentation explains the implementation of admin access restrictions in the frontend of the OnTrack system under the Capstone project with Thoth Tech. + +## Technologies Used +- Angular (routing and guards) +- Visual Studio Code +- Git (feature/admin-access-control branch) +- Astro Framework (for documentation) +- Node.js + Dev Containers + +## Key Actions +- Set up dev environment and confirmed running ports (4200 for frontend). +- Implemented route guards to restrict `/admin/units` from student access. +- Redirected unauthorized users to a dashboard or error page. +- Used a dedicated Git branch to manage changes safely. +--- + +## Testing Methodology + +### Manual Testing Approach + +The admin access control functionality was manually tested in a local development container using the Angular app served at `localhost:4200`. + +- **Step 1:** Log in with a **student/non-admin account**. +- **Step 2:** Attempt to visit the admin route: `/#/admin/units`. +- **Expected Result:** The student should be redirected to a non-admin page (dashboard or error). +- **Actual Result:** The user was redirected and shown a page with the message: + > “You are not enrolled in any OnTrack units.” + +✅ This confirms that unauthorized users are blocked from admin content. + +### Screenshot (Test Output) + +![Unauthorized Output](../assets/screenshots/unauthorised-result.png) + +--- + +## Conclusion + +This test confirms that the admin route protection is working as intended. Future improvements may include automated testing using Angular's testing tools or Cypress. + +## Screenshots +- Unauthorized access test: + ![Unauthorized Access](../assets/screenshots/unauthorised.png) + +- Repo forked view: + ![Repositories](../assets/screenshots/repos.png) + +- Ports in dev container: + ![Ports](../assets/screenshots/ports.png) + +## Notes +This restriction improves user experience and protects sensitive admin features from misuse.