Skip to main content

Roles and Permissions

Signing in proves who you are. Roles and permissions decide which features you can use. Every account has exactly one role; a role is a named list of permissions.

note

The detection, CO₂ interpolation, and flood replay features these permissions guard call services that run on Jetstream2 at Indiana University through NSF ACCESS allocation CIS251126. See the Acknowledgments.

Roles​

RoleGets
adminEverything, including the user admin page
memberAll standard features and worlds, except restricted extensions and user admin
co2CO₂ sensors only
emergencyEmergency Management only
codetrEverything that uses Co-DETR: Florida camera vehicle scans and detection, plus Emergency Management
viewerThe base map only. Default for every new account.

Add more roles in the SQL editor (insert into roles and role_permissions); the admin page lists whatever exists.

Permissions​

PermissionUnlocks
feature.co2CO₂ sensors, sensor history, CO₂ interpolation
ext.*A restricted extension (see below). Held by admin and by roles you grant it to by hand.
feature.flood_replayHurricane Ian simulation
feature.emergencyEmergency Management events
feature.power_outageDuke Energy Florida outages
feature.detectionCo-DETR detection, Florida camera vehicle scans
planet.mars, planet.moonThe Mars and Moon worlds
admin.users/admin (assign roles, invite users)

Restricted extensions​

Some features are not just hidden for other accounts; they do not exist for them. Each lives in a server-side folder (server/protected/<id>/, or the folder named by EXTENSIONS_DIR) that is never served as a static file. Its ext.json names the permission that unlocks it. After sign-in the browser asks GET /ext/manifest for the extensions its account may use and fetches only those; the code, data and images of any other extension are never sent, and requesting them returns a plain 404. Accounts with no extensions see no trace of them.

The person icon in the sidebar header opens a small profile dialog with the signed-in email, the role, and a Special access list naming the restricted extensions the account holds (names come from each extension's ext.json label, and only entitled accounts receive them).

Because extension code can build on data the account already has (for example CO₂ sensors), an extension's permission controls access to the extension itself, not to the underlying standard data.

Everything not listed (land use, traffic, weather, AQI, cameras, tilesets) is available to any signed-in user.

How it works​

  1. supabase/access-control.sql creates the tables and a Custom Access Token Hook. When Supabase issues a token it adds user_role and permissions to the JWT.
  2. Express (server/access.js) verifies the token on every request with supabase.auth.getClaims() and checks the permission (requireFeature). Missing token is 401; missing permission is 403. This is the enforcement.
  3. js/core/access.js adds the token to same-origin fetch calls and hides any element with data-requires="<permission>". This only keeps the interface tidy.

To gate a new feature: add the permission to the SQL seed and to the roles that get it, put requireFeature(PERM.X) on its route, and put data-requires="..." on its button.

Changing someone's role​

Open /admin (visible to admins as Users in the sidebar header), or run SQL:

update public.user_roles set role = 'member'
where user_id = (select id from auth.users where email = 'someone@ucf.edu');

The change reaches that person when their token refreshes (up to an hour) or when they sign in again.

Configuration​

VariablePurpose
SUPABASE_SERVICE_ROLE_KEYLets /admin list users and set roles. Server only; never put it in the browser or commit it. Without it /admin/api answers 501.
SITE_URLBase URL for invite emails (https://geo-lens.net).
ACCESS_CONTROL=offDisables all checks for local development. Never in production.
GATEWAY_SHARED_SECRETAlso set on the Jetstream2 CO₂ and Flood services so they only answer this server.
CESIUM_ION_TOKEN_MARS, CESIUM_ION_TOKEN_MOONOptional ion tokens restricted to that world's assets.

Known limits​

  • /tomtom-traffic stays open to the public: it serves map tiles that the browser requests as images, which cannot carry the token.
  • Mars and Moon use the same Cesium ion token as Earth unless CESIUM_ION_TOKEN_MARS / _MOON are set to asset-restricted tokens, so a user without access who extracts the Earth token could still load those ion assets.
  • Role changes are not instant (see above).