Running a site
The editor and users
The editor is a floating toolbar at the bottom of the page, shown to signed-in users. From it, editors switch editing on and off, change the page's properties (title, path, type, description, sharing image, public or hidden, delete), open the page list and create new pages, edit the global settings, and publish or discard the unpublished changes. The toolbar can be collapsed, and it remembers that.
These keyboard shortcuts work everywhere on the page:
| Keys | Action |
|---|---|
Ctrl+S |
Save |
Ctrl+Shift+S |
Publish |
Ctrl+E |
Editing on or off |
Esc |
Close the panel |
On a Mac, ⌘ works in place of Ctrl.
Working with images
Editors upload images by dragging them onto an image block or into the media library, and they give each one an alt text. Lapis sanitizes uploaded SVGs, so scripts, event handlers and external references are removed. See Images and media.
Nothing gets lost
What an editor types is also kept by the browser until the server has it:
- When the browser is offline or the server answers with an error, a lasting notice says so, and saving retries by itself.
- When the session has expired, the pending changes are saved after "Sign in in a new tab".
- When the tab is closed before that, the changes come back the next time it is opened.
How it looks
The editor runs in a Shadow DOM, so the page's CSS does not affect it.
It uses a single colour, the blue of lapis lazuli. The editor is a blue drawer docked to the bottom of the screen, and the panels slide out of it. "Not published yet" is shown by pattern and lightness instead of a second colour: a draft's outline is dotted (dashed on hover, solid on focus), its marker is a pale periwinkle, and Publish is the only white element of the drawer.
The typeface is Schibsted Grotesk (SIL OFL 1.1), shipped in resources/editor/fonts, so no CDN is used. Light and dark mode follow the system.
Users, roles and the log
Roles
Every account has one of two roles:
adminmay do everything.editorworks with the content: pages, blocks, publishing, media, data and form submissions.
Only admins change the global settings, the users, the redirects and the 404 log, and only they read the audit log. The API checks the role, and the editor hides what the role may not do.
Create editors in the Users panel, or with ./lapis user:create --role=editor.
The Users panel
Admins manage the accounts in the Users panel. A new user gets a generated password to pass on, and when e-mail is configured, an invitation by e-mail too. Admins change the role of an account, disable or enable it, or delete it. A disabled account is signed out at once and cannot sign in.
The site always keeps at least one active admin, and nobody can demote, disable or delete their own account.
The audit log
The Log panel shows who published, discarded, created, changed or deleted pages, saved the settings, changed media, data records or users, and who signed in. Admins filter it by kind and by user. Saving a block draft is not logged, publishing it is.
Entries are kept for auditLogDays (365 by default), and log:prune removes older ones daily with schedule:run.
In code
To check permissions in your own code, use $auth->can('settings') and $auth->role(), or protect a page with new RequireRole(Role::Admin). For log entries of your own, take Lapis\Audit\AuditLog from the container and call $auditLog->record('my.action', $subject, $url, $detail).