Media module, users hardening, README and token ledger
This commit is contained in:
1 parent
f86f5aea28
commit
9f2a21fa1f
22 files changed
+827
-24
No files matched your search
@@ -31,11 +31,44 @@ that one is off.
|
||||
Implement `IriksIT\Manager\Contracts\Module` (or extend `Modules\BaseModule`), keep `routes.php` and a
|
||||
`migrations/` folder next to the class, and add the class to `available` in the config.
|
||||
|
||||
## State of this first version
|
||||
## Users module
|
||||
|
||||
Done: module registry and switches, permissions per module as gates, groups, super admin, routes and
|
||||
migrations per module, a menu that shows only what an account may reach, tests (`composer test`).
|
||||
Accounts and groups. `HasManagerAccess` on the host `User` model gives it `managerGroups()`,
|
||||
`managerPermissions()`, `hasManagerPermission()`, `managerOutranks()` and `managerMayGive()`.
|
||||
Keep `is_super_admin` out of `$fillable`: nobody becomes a super admin through a form.
|
||||
|
||||
Not done yet, on purpose: the screens. The modules answer with JSON; the frontend (the Inertia/Vue
|
||||
screens of bouwbedrijf.iriks-it.nl, or something the package ships itself) is the next decision, see
|
||||
`AGENTS.md`.
|
||||
```bash
|
||||
php artisan manager:create-user # the only way to make a super admin
|
||||
```
|
||||
|
||||
- A group is a name plus permissions; a permission that needs another one (`posts.publish` needs
|
||||
`posts.write`) brings it along. Permissions of a module that is off are ignored.
|
||||
- Whoever manages accounts only touches accounts that need nothing more than their own rights, and
|
||||
only hands out groups that give nothing they lack themselves.
|
||||
- `groups.manage` is a gate for super admins only, not a permission of a group.
|
||||
- The package defines one gate per permission and **no `Gate::before`**: it never answers for the
|
||||
abilities of your own app.
|
||||
- The migration adds `is_super_admin` to your users table (the table of `manager.user_model`). It
|
||||
promotes nobody.
|
||||
|
||||
## Media module
|
||||
|
||||
Files live on a Laravel filesystem disk (`manager.media.disk`); each row remembers its own disk.
|
||||
|
||||
- Manager (behind `manager.middleware`): `GET /manager/media`, `/manager/media/items`, `POST`,
|
||||
`PUT /{id}`, `DELETE /{id}`. Limits (total room, file size, extensions) are in `manager.media.*`.
|
||||
- Visitors: `GET /media-files/{id}/{filename}/view`, outside the manager, no session. ETag, byte
|
||||
ranges, `nosniff`, and only images, video and PDF are shown inline. Rate limiter `media-files`.
|
||||
- Where a file is used: other modules or your app register a source with
|
||||
`app(IriksIT\Manager\Support\MediaUsage::class)->register(fn () => $texts)`. Posts and Pages do.
|
||||
- No SVG: it can carry scripts.
|
||||
|
||||
## State of this version
|
||||
|
||||
Done: module registry and switches, permissions per module, users (accounts, groups, command) and
|
||||
media (library and public file route), 30+ tests (`composer test`).
|
||||
|
||||
The answers of every action are JSON, in the shape the screens of bouwbedrijf.iriks-it.nl got as
|
||||
Inertia props. The screens themselves are not in the package yet: the frontend is an open decision
|
||||
(`AGENTS.md`). Posts, pages and reviews are still skeletons (a list), and so are login, profile, the
|
||||
audit log and revisions: they are not part of users and media.
|
||||
Reference in new issue
Block a user