Documentation / LemmeSee Hub

Permissions and grants

Everything a user can see or do on the hub is controlled by permission keys. Each user holds a set of grants (keys they have) and a set of revocations (keys taken away). The hub web UI, the REST API and the MQTT broker all check the same keys, so a user who can't see a feed in the web UI won't receive it on their phone either.

You edit both sets on the Users page with Features on a user's row, or through the REST API. Presets give you a quick starting bundle; see Users and access keys.

Public and private

Most things the hub serves have a tier:

  • Public items are visible to every signed-in user by default. You hide one from a particular user by revoking it.
  • Private items are visible only to users who have been granted them.

The key for an item is <kind>.<tier>.<id>, for example feeds.public.backups or streams.private.porch.

Kind<id> isHow an item becomes private
feedsThe feed idVisibility set to Private on the feed. See Server feeds.
streamsThe stream nameThe Private box in the stream's settings. See Streams.
pluginsThe plugin's namePLUGIN_PRIVATE = True in the plugin file.
pingsThe ping codeSent on the private channel. The code's label follows its entry in ping_messages in config.json: {"label": "...", "private": true} is private, a plain label is public. See Logs and pings.
logsThe log sourceSent on the private channel. On the hub's own pages and API, the source's entry in log_sources in config.json decides instead. See Logs and pings.
webhooksThe webhook idMarked private when the webhook is created.
feed_filtersAn RSS feed's idFollows the feed's own tier.
named_filtersThe filter idFILTER_PRIVATE = True in the filter file. See Named filters.
actions(none)Chosen by whoever sends the approval request. The keys are actions.public and actions.private. See Approvals.

Two kinds have no public tier and always need a grant:

KeyCovers
states.<plugin>.<name>One state. states.<plugin>.* covers all of a plugin's states, states.* all states. See States.
relay.<server id>.…A relayed server's logs and states: relay.<server id>.logs.public.<source> (shown unless revoked), relay.<server id>.logs.private.<source>, relay.<server id>.states.<group>.<name>, or relay.<server id>.* for all of them. Set them with Permissions on the person's server key. See Relayed servers.
tasks.private.<task_id>One task on the Tasks page and in the task API. tasks.private.* covers every task.

Something a user can't see is answered exactly like something that doesn't exist (usually a 404), and it is left out of every list. Nothing reveals that it's there.

Logs and pings

Scripts choose the tier of each log line and ping when they send it, and the source (for logs) or code (for pings) is the last part of the MQTT topic. See Public and private channels. The broker checks one key per source or code:

KeyCovers
logs.public.<source>Public log lines from one source. Visible by default; revoke it to hide them.
logs.private.<source>Private log lines from one source. Hidden until granted.
pings.public.<code>Public pings with one code. Visible by default; revoke it to hide them.
pings.private.<code>Private pings with one code. Hidden until granted.

On phones, the tier comes from the topic the message was sent on, whether or not the source or code is listed in config.json.

The hub's own lists work from config.json instead:

  • On the Logs page, the Dashboard, and the logs API, a source takes its tier from its entry in log_sources. A source that isn't listed there counts as private, so its lines show only to users granted logs.private.<source> (or a wildcard).
  • The ping labels a phone receives come from ping_messages, each with its own tier. The app acts only on pings whose code has a label, so a user who can't see a code's label gets nothing from that ping, whatever channel it was sent on. See ping_messages.

Pings sent to one user's topic id skip these keys. See Messages for one user.

Hub pages

Each section of the hub web UI has two keys:

KeyGives
sections.<name>.viewThe page, its lists, and its link in the menu.
sections.<name>.editEverything in view, plus the page's add, edit, and delete controls and the API calls behind them, and the settings and secrets those forms show.

The sections are logs, states, streams, tasks, feeds, webhooks, filters, users, and diagnostics. The Dashboard is always available and shows only the parts whose sections the user holds.

The records inside a section are still filtered by their own keys: a user with the Feeds page sees only the feeds they can see. And a record's own address needs only the record's key, so a user granted one stream can open it without the Streams page.

Some actions need a particular edit key:

ActionNeeds
Creating, editing, running, or deleting taskssections.tasks.edit
Seeing pending approvals and sending a test approvalsections.tasks.edit
Creating and deleting webhooks, seeing their secrets, and the handler listsections.webhooks.edit
Creating, editing, scanning, and deleting feedssections.feeds.edit
Changing stream settings, and full access to the media brokersections.streams.edit
Managing users, grants, invites, and other users' plugin keyssections.users.edit
Restarting the hubsections.diagnostics.edit

Other keys

KeyGives
*Everything. This is what makes a user an admin.
plugin_keys.mintCreating plugin keys. The Plugin keys switch in a user's Keys dialog grants and removes it.

Plugins can define and check keys of their own, which you grant the same way.

Patterns

Grants and revocations are patterns, so one entry can cover many keys:

PatternMatches
*Every key.
feeds.public.backupsExactly that key.
feeds.private.*Every key starting with feeds.private., at any depth.
[feeds|streams].private.*Brackets list alternatives: this covers feeds.private.* and streams.private.*.
streams.[public|private].[porch|garage]Bracket groups combine: four keys in one entry.

Revocations

A revocation always wins. If any revocation matches a key, the user doesn't have it, whatever their grants say, even *, and even for a public item. Revoking is the only way to hide a public item from one user:

  • Revoke feeds.public.builds to hide the builds feed from a user.
  • Revoke pings.public.* to stop all public pings reaching them.
  • Revoke streams.* to hide every stream, public or private.

In the Features dialog, add a pattern under Revocations to revoke it, and click Restore next to one to remove the revocation.

Presets

Presets are bundles of grants. Applying one adds its keys; it never removes anything. These are the exact keys:

PresetGrants
ListenerNothing. Public items are visible anyway.
Read Onlysections.[feeds|streams|states].view, [feeds|plugins].private.*, states.*
DeveloperEverything in Read Only, plus [logs|pings|actions|webhooks|feed_filters|named_filters].private.*, plugin_keys.mint, sections.[logs|tasks|webhooks|filters].view, tasks.private.*
Admin*

No preset grants private streams, since a stream can show a camera or a screen. Grant each one by name.

Editing a user's permissions

Click Features on the user's row. The dialog has two parts:

  • Features: the user's grants. Type a key or pattern and click Grant, click Revoke next to one to remove it, or pick a preset under Apply preset to add its keys.
  • Revocations: patterns taken away from the user, as described above.

Changes apply straight away. Connected phones are told to refresh their lists of feeds, streams, plugins, and so on, and the broker picks up the change within a few seconds.

Checking what a user sees

Click View as on a user's row, or add ?sim=<username> to any hub page address, to see the hub exactly as that user does. While viewing as someone else, everything is read only. Add an empty ?sim= to go back to yourself. This needs sections.users.edit and works in a signed-in browser session only.