Skip to content

Commit f77eafc

Browse files
authored
Merge pull request #241 from dotkernel/admin-audit
updated light, frontend
2 parents 515177e + ceaeec4 commit f77eafc

2 files changed

Lines changed: 36 additions & 48 deletions

File tree

‎public/frontend.md‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Web starter . Server-rendered
1212
A web starter skeleton on the Mezzio microframework and Laminas components, for the applications people log into.
1313
User accounts, a working contact form and a content page ship as proof of concept - real, running features whose only job is to show you where your own code goes.
1414

15-
- [Read the docs](https://docs.dotkernel.org/frontend/)
15+
- [Read the docs](https://docs.dotkernel.org/frontend-documentation/)
1616
- [View on GitHub](https://github.com/dotkernel/frontend)
1717
- [Live demo](https://v5.dotkernel.net/)
1818

@@ -24,7 +24,7 @@ User accounts, a working contact form and a content page ship as proof of concep
2424

2525
## Request lifecycle
2626

27-
Session (`dot-session`) -> Router (FastRoute) -> Authentication (User identity) -> RBAC guard (route + action) -> Controller action (`dot-controller`) -> Response (Twig + flash).
27+
Error handler (`dot-errorhandler`) -> Session (`dot-session`) -> CORS (`mezzio-cors`) -> Router (FastRoute) -> Response headers (`dot-response-header`) -> Remember me + Authentication (User identity) -> RBAC guard (route + action) -> Navigation (`dot-navigation`) -> Controller action (`dot-controller`) -> Response (Twig + flash).
2828

2929
## The web application half of the stack
3030

@@ -36,7 +36,7 @@ They exist to showcase the file architecture and to be copied.
3636

3737
Extending the power of Mezzio by Laminas.
3838

39-
- User accounts, from register to unregister
39+
- User accounts, from registration to account deletion
4040
- Action controllers, not request handlers
4141
- CSRF and reCAPTCHA on public forms
4242
- GDPR anonymization out of the box
@@ -49,8 +49,8 @@ These are the parts you would otherwise spend your first two weeks assembling, a
4949

5050
The whole account lifecycle, already routed.
5151

52-
Login, registration and account management, including avatar upload, password change and unregistering.
53-
Password reset and account activation emails are part of the flow, which is why the skeleton stores a name and an email address and nothing more.
52+
Login, registration and account management, including activation, password reset, avatar upload, profile details, password change and account deletion.
53+
Password reset and account activation emails are part of the flow, which is why the only personal details on a user profile are a name and an email address.
5454

5555
### Guards per action - Security . Access control
5656

@@ -70,8 +70,8 @@ Tokens expire after a configurable timeout - one hour by default - and are never
7070

7171
A public form that does not become a spam relay.
7272

73-
The contact form uses Google reCAPTCHA, with the site and secret keys read from local configuration and the message recipients - `to` and any number of `cc` addresses - configured alongside them.
74-
Whitelist `localhost` while developing, and take it out again for production.
73+
The contact form uses score-based Google reCAPTCHA, with the site key, secret key and score threshold read from local configuration, and the message recipients - `to`, `cc` and `bcc` addresses - configured alongside them.
74+
The contact page will not render until the keys are set; whitelist `localhost` while developing, and take it out again for production.
7575

7676
### Flash messages - UX . Feedback
7777

@@ -96,9 +96,9 @@ Migrations live in `data/doctrine/migrations`; `bin/doctrine fixtures:execute` s
9696

9797
### Headers & CORS - Delivery . HTTP
9898

99-
Response headers declared per route.
99+
Response headers declared globally or per route.
100100

101-
`dot-response-header` sets custom headers per route from `response-header.global.php`, while `mezzio-cors` handles origins, headers and cookies from `cors.global.php`.
101+
`dot-response-header` sets custom headers for all routes or for individual routes from `response-header.global.php`, while `mezzio-cors` handles origins, headers and cookies from `cors.global.php`.
102102

103103
### Menus, templates, i18n - Content . Presentation
104104

@@ -113,16 +113,17 @@ The `Plugin` module carries dynamic forms and templates.
113113
Under the GDPR, a company recording personal data from EU citizens must delete it on request - or anonymize it, which the European Commission accepts as an alternative.
114114
Frontend implements the second option, because deleting a user row is rarely what your foreign keys want.
115115

116-
The skeleton stores only what it needs to run those flows: first name, last name and the email address used as the identity, for password reset and account activation.
117-
Anonymizing replaces exactly those.
116+
On the user profile, the skeleton stores only what it needs to run those flows: first name, last name and the email address used as the identity, for password reset and account activation.
117+
Anonymizing replaces exactly those; contact form messages and remember-me records are kept as they are.
118118

119119
- [Anonymization reference](https://docs.dotkernel.org/frontend-documentation/v5/reference/account-anonymization/)
120120

121121
### What anonymization changes
122122

123-
- First and last name become `anonymous` plus the current UNIX timestamp - for example `anonymous1725980747`.
124-
- The email becomes the same value plus whatever you set in `userAnonymizeAppend` - `anonymous1725980747@example.com`.
125-
- The avatar image and its database record are deleted.
123+
- First and last name become `anonymous` plus the current date and time in `dmYHis` format - for example `anonymous23092026155300`.
124+
- The email becomes the same value plus whatever you set in `userAnonymizeAppend` - `anonymous23092026155300@example.com`.
125+
- The account status is set to `deleted`; the row itself is kept.
126+
- On account deletion, the avatar image and its database record are deleted.
126127

127128
Point `userAnonymizeAppend` at a domain you control and it doubles as a catch-all address, if your mail provider supports one.
128129
Leave it empty and the local part stands alone.
@@ -153,7 +154,7 @@ Plugin functionality for dynamic forms and templates.
153154

154155
### Module contents
155156

156-
`Controller`, `Entity`, `Repository` and `Service` folders, plus `InputFilter`, `EventListener`, `Helper`, `Command` or `Factory` as needed.
157+
`Controller`, `Entity`, `Repository` and `Service` folders, plus `Form`, `Fieldset`, `InputFilter`, `EventListener`, `Factory`, `Middleware` or `Enum` as needed.
157158

158159
## From clone to welcome page
159160

@@ -187,7 +188,7 @@ composer development-enable
187188

188189
### 4 . Prepare the config files
189190

190-
Copy the `.dist` files into place - `local.php`, `development.local.php`, `mail.local.php`, `debugbar.local.php` - then fill in the database, SMTP and reCAPTCHA details.
191+
`composer install` has already created `local.php` and `mail.global.php`, and development mode created `development.local.php`; fill in the database and reCAPTCHA details in `local.php`, and copy `mail.global.php` to `mail.local.php` for the sender and SMTP details, so credentials stay out of git.
191192

192193
### 5 . Migrate and seed
193194

@@ -214,11 +215,11 @@ Duplicating `local.test.php.dist` gives your tests an in-memory database.
214215
| Component | Requirement |
215216
| --- | --- |
216217
| Operating system | A \*nix based system is strongly recommended for production. |
217-
| PHP | 8.2 or newer, mod_php or FCGI (FPM). `memory_limit` at least 128M; `upload_max_filesize` and `post_max_size` at least 100M depending on your data. |
218+
| PHP | 8.2 or 8.3, mod_php or FCGI (FPM). `memory_limit` at least 128M; `upload_max_filesize` and `post_max_size` at least 100M depending on your data. |
218219
| Web server | Apache 2.2+ with `mod_rewrite` and `.htaccess` support (`AllowOverride All`); a default `.htaccess` ships in `public/`. On Nginx, translate it into server configuration. |
219220
| Database | Tested with MariaDB 10.11 LTS and 11.4 LTS, and with MySQL 8.4 LTS. For MySQL 8.4, `my.cnf` needs `mysql_native_password=ON`. |
220-
| Required extensions | `mbstring`, the CLI SAPI for cron jobs, and Composer on `$PATH`. |
221-
| Recommended extensions | `opcache`; `pdo_mysql` or `mysqli`; `dom` and `simplexml` for markup; `gd` and `exif` for images; `zlib`, `zip`, `bz2` for compression; `curl` when calling APIs; `sqlite3` for the test suite. |
221+
| Required extensions | `curl`, `gettext`, `intl`, `json`, `mbstring`, the CLI SAPI for cron jobs, and Composer on `$PATH`. |
222+
| Recommended extensions | `opcache`; `pdo_mysql` for MySQL or MariaDB; `dom` and `simplexml` for markup; `gd` and `exif` for images; `zlib`, `zip`, `bz2` for compression; `sqlite3` for the test suite. |
222223

223224
Note that Frontend still supports MySQL - unlike API and Admin v7, which require native UUID support and therefore PostgreSQL or MariaDB 10.7+.
224225

‎public/light.md‎

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ One command while you work, one before you ship.
134134

135135
Vite concatenates and compresses CSS and JavaScript, preprocesses SCSS, and copies fonts and images - avoiding the network bottleneck of many separate files.
136136
`npm run watch` recompiles on change; `npm run build` compiles once.
137-
Node.js v20 is the minimum supported version.
137+
Node.js `^20.19.0` or `>=22.12.0` is required.
138138

139139
### assets -> public - Build . Source of truth
140140

@@ -174,56 +174,43 @@ Development mode adds the error handlers you want locally and nowhere else.
174174
## Running in minutes, honestly
175175

176176
No database to create, no fixtures to seed.
177-
Clone, install, set a URL, open it.
177+
Create the project, set a URL, open it.
178178

179-
### 1 . Clone into an empty folder
179+
### 1 . Create the project
180180

181-
Git refuses a directory that is not empty, and you need write permissions on it.
181+
One Composer command creates the directory, installs dependencies, and enables development mode for you.
182182

183183
```shell
184-
git clone https://github.com/dotkernel/light.git .
184+
composer create-project dotkernel/light dk
185+
cd dk
185186
```
186187

187-
### 2 . Install dependencies
188+
Decline the config provider injection when prompted - Light already includes its own.
188189

189-
Run it from the CLI so the prompts stay interactive.
190-
Decline the config provider injection - Light already includes its own.
191-
192-
```shell
193-
composer install
194-
```
195-
196-
### 3 . Enable development mode
197-
198-
Local work only.
199-
`composer development-status` reports where you stand.
200-
201-
```shell
202-
composer development-enable
203-
```
204-
205-
### 4 . Set the base URL
190+
### 2 . Set the base URL
206191

207192
Point `$baseUrl` in `config/autoload/local.php` at your virtual host.
208193

209-
### 5 . Fix the writable folders
194+
### 3 . Fix the writable folders
210195

211196
The two directories the application writes to.
212-
Most first-run errors are this and nothing else.
197+
Most first-run errors are this and nothing else. Give the web server group write access instead of opening the folders to everyone:
213198

214199
```shell
215-
chmod -R 777 ./data ./log
200+
sudo chown -R "$USER":www-data data log
201+
sudo chmod -R 775 data log
216202
```
217203

218-
### 6 . Open it in a browser
204+
### 4 . Open it in a browser
219205

220206
The Dotkernel Light welcome page is waiting.
221207
Errors about missing services usually mean a stale config cache.
222208

223209
```shell
224-
php ./bin/clear-config-cache.php
210+
composer clear-config-cache
225211
```
226212

213+
Do not run this with `sudo` - that leaves the regenerated `data/cache/config-cache.php` owned by root, which the application can no longer rewrite.
227214
A cached `data/cache/config-cache.php` is loaded regardless of the `ConfigAggregator::ENABLE_CACHE` setting - which is exactly why clearing it fixes so much.
228215
On Windows, WSL2 with AlmaLinux is the recommended development environment.
229216

@@ -232,7 +219,7 @@ On Windows, WSL2 with AlmaLinux is the recommended development environment.
232219
| Component | Requirement |
233220
| --- | --- |
234221
| Operating system | A \*nix based system is strongly recommended for production. |
235-
| PHP | 8.2, 8.3 or 8.4, with mod_php or FCGI (FPM). `memory_limit` at least 128M. |
222+
| PHP | 8.3, 8.4 or 8.5, with mod_php or FCGI (FPM). `memory_limit` at least 128M. |
236223
| Web server | Apache 2.2+ with `mod_rewrite` and `.htaccess` support (`AllowOverride All`); a default `.htaccess` ships in `public/`. On Nginx, translate it into server configuration. |
237224
| Database | None. Light has no persistence layer - which is the point. |
238225
| Required extensions | `mbstring`, plus Composer available on `$PATH`. |

0 commit comments

Comments
 (0)