# Project plan — SecOps

Evidence date: 2026-10-04.

Source repository: `git@bitbucket.org:overdrive/secops.git`.

Inspected revision: `master` at `b6fa27b` (2022-03-30, Joshua Gatley-Dewing, "Merged in forgot_password_template (pull request #1)"). The scan-host path `~/projects/sonar_scan/repos/SecOps` was not on this machine. The tree below was read from that git revision. Credential values in `main.sql` are not reproduced.

This plan describes what the repository contains. It does not decide what the product should become.

## Product

The repository name is **SecOps**. Nothing in `README.md`, the controllers, or the seeded settings uses that name.

| String | Where | Provenance |
|---|---|---|
| SecOps | Git repository slug only | Repository identity |
| AdminPRO | Seeded `settings.company_name` in `main.sql` | Implemented (seed data) |
| README placeholders | `README.md` is Bitbucket's default template ("Quick summary", "How do I get set up?") | Documented, and empty |

On `master`, the running application is a CodeIgniter 3.1.11 admin shell on AdminLTE 3.0.5. A signed-in user can manage users, roles, permissions, company and general settings, email templates, activity logs, and a database backup download. The home dashboard is the AdminLTE sample page with fixed numbers. It does not query SecOps data.

**Unknown / Requires Confirmation:** whether "SecOps" was the intended product name, whether AdminPRO was only the upstream starter's brand, and who the production users are.

## Current status

Last commit on `master` is 2022-03-30. History on `master` is four commits:

| Commit | Date | Author | Subject |
|---|---|---|---|
| `904a0c8` | 2022-03-22 | Jaco Brits | Initial commit |
| `e550265` | 2022-03-28 | Jaco Brits | First commit |
| `511199b` | 2022-03-29 | Joshua Gatley-Dewing | Use email template table for reset template |
| `b6fa27b` | 2022-03-30 | Joshua Gatley-Dewing | Merged in forgot_password_template (pull request #1) |

There is no deployment manifest, pipeline, test suite, or milestone list in the repository. Host, environment, and whether anyone still runs this build are **Unknown**.

The task-creation scan listed `sonar-project.properties` and `sonarqube_scan.bat` beside `README.md`. Neither file is in git on `master` or on `basic_mvc_structure`. **Not in git.**

## Scope on master

In scope of the committed application:

- Sign-in, remember-me cookie, sign-out, and password reset by email.
- Optional Google reCAPTCHA on sign-in, off in the seed.
- Users, roles, and permission codes.
- Activity log list and detail, filterable by user id and IP.
- Company name and email, date formats, timezone, default language.
- One email template (`reset_password`), editable in the UI.
- Database backup download (zip).
- Profile: name, contact, picture, password, language cookie.
- AdminLTE example pages (charts, forms, mailbox, tables, UI) linked from the sidebar for every signed-in user.

Out of scope of `master`, because the code is not there:

- SonarQube, nmap, or file-integrity monitoring.
- Clients, sites, scan history, or PDF reports.
- A second organisation or tenant.

## Unmerged branch

`basic_mvc_structure` is ahead of `master`. Tip `cad6860` (2022-03-31, Joshua Gatley-Dewing, "new role and new permissions"). It is **not** on `master`.

That branch adds controllers under `application/controllers/projects/` and a third role, `User`. Each new action checks a permission code and then loads the same static `dashboard` view. No scan is started, no result is stored, and no PDF is built.

| Controller | Actions | Permission code |
|---|---|---|
| `projects/Clients` | `index` | `clients` |
| `projects/Sites` | `index` | `manage_sites` |
| `projects/History` | `sonarqube`, `nmap`, `fim` | `sonarqube_tool`, `nmap_tool`, `fim_tool` |
| `projects/Reporting` | `generate_pdf` | `reporting` |
| `projects/Tools` | `sonarqube_schedule`, `sonarqube_setup`, `nmap_scan`, `nmap_results`, `fim_scan`, `fim_results` | matching tool code |

The branch SQL seed adds those permission codes plus `view_examples` and `general_dashboard`, and role id 3 titled `User`. Grants in that seed: Admin receives every new code; Manager receives `general_dashboard`, `manage_sites`, `reporting`, and `clients`; User receives `general_dashboard`, `sonarqube_tool`, `nmap_tool`, `fim_tool`, and `manage_sites`. Provenance: **Planned** only in the sense that the branch exists and was not merged. The screens themselves are stubs.

**Requires Confirmation:** whether `basic_mvc_structure` is the product direction or abandoned work.

## Architecture

```text
Browser
  → Apache rewrite (.htaccess) → index.php
  → CodeIgniter 3.1.11 (system/)
  → application/controllers
  → MySQL via mysqli (database name in config: personal)
  → settings, users, roles, permissions, role_permissions,
    activity_logs, email_templates
  → uploads/ for user images and login background
  → Google reCAPTCHA siteverify (only when the setting is on)
  → PHP mail() for password reset (no application/config/email.php)
```

Sessions are files, two hours (`application/config/config.php`). There is no queue, cache server, or background worker.

## Major components

| Component | Path | Role |
|---|---|---|
| Front controller | `index.php` | `ENVIRONMENT` from `CI_ENV`, otherwise `production` |
| Auth | `application/controllers/Login.php`, `Logout.php`, `application/models/Users_model.php` | Sign-in, reset, session and cookie |
| Gate | `application/core/MY_Controller.php` | Requires a configured database and a signed-in user |
| Admin modules | `Users.php`, `Roles.php`, `Permissions.php`, `Settings.php`, `Activity_logs.php`, `Backup.php`, `Profile.php`, `Dashboard.php` | The product screens on `master` |
| Theme samples | `application/controllers/adminlte/` | AdminLTE demos, not domain data |
| Schema dump | `main.sql` | Structure and seed, including historical activity rows |
| UI | `assets/` (AdminLTE v3.0.5), `application/views/` | Layout, lists, forms |

## Dependencies

- PHP with the mysqli extension. The front controller still branches on PHP 5.3 for error reporting. The exact runtime version is **Unknown**.
- MySQL or MariaDB. Tables are `ENGINE=InnoDB`, `CHARSET=latin1` in the dump. The connection charset in `database.php` is `utf8`.
- Apache `mod_rewrite`, from `.htaccess`.
- AdminLTE 3.0.5 and the plugins under `assets/plugins/` (jQuery, DataTables, CKEditor, and others shipped with the theme).
- Google reCAPTCHA HTTP API when enabled.
- A working `mail()` transport for password reset. None is configured in the repo.

No root `composer.json`. CodeIgniter migrations are disabled (`application/config/migration.php`).

## Milestones

No milestone document exists. The only delivered change after the import is pull request #1: password reset reads the `email_templates` row with code `reset_password` instead of a hardcoded body (`511199b`).

## Implementation plan

There is no written plan in the repository. The unmerged branch is the only evidence of a next step, and that step stops at empty pages. What should be built next is **Unknown / Requires Confirmation**.
