Skip to main content

Overview

Set permissions on each document when you index it. Search only returns documents the signed-in user is allowed to see.
Access is always scoped to the datasource first. A signed-in user sees a datasource’s documents only if they are registered as a user on that datasource (POST /users --- see Specific users only). This applies to anonymous documents too: allow_anonymous_access: true (and documents indexed with no permissions block) are visible to every registered user of that datasource, but not to org members who have no user record on it. Register yourself before expecting to see your own indexed content.
User context uses login email. The person searching is always an amber user identified by the email on their account (the email they have when they log in to amber). Every permission that targets a specific person must use that same email: POST /users → user.email, allowed_users → { "email": "..." }, POST /memberships → member_email, and POST .../documents/check-access → user_email. Email lookups are case-insensitive (stored lowercased).
Pick one primary rule per document: How the permissions block is evaluated:
  • If allow_anonymous_access is true, the document is anonymous and any allowed_users / allowed_groups on it are ignored.
  • Otherwise, every email in allowed_users and every name in allowed_groups is granted access. Names in allowed_groups are not checked against existing groups, so a typo silently grants nobody.
  • If allow_anonymous_access is false (the default) and both lists are empty or missing, the document falls back to anonymous, exactly as if permissions were omitted.
Documents indexed without a permissions block are stored with the anonymous token. That token reaches only users who are registered on this datasource (created with POST /users) --- not everyone in your amber org. A signed-in user with no user record on the datasource sees none of its documents, including anonymous ones. To restrict further within the datasource, send allowed_users and/or allowed_groups on the document.

1. Open to everyone registered on the datasource

“Anonymous” here means no per-user or per-group restriction inside the datasource --- it does not mean public to your whole org. The document is still only reachable by people registered on the datasource via POST /users.

2. Specific users only

Permissions are always resolved by email --- the same address on the user’s amber account. a) Register each person once per datasource. email is required and must equal the address on their amber user profile (same as when they log in). The optional name is for display only and does not replace email for access checks.
Response codes for POST /users Update a user’s display name later with PUT /users/{datasource}/{email}:
Response codes for PUT /users/{datasource}/{email} b) Reference them on the document with allowed_users and the same emails:

3. Groups

Order of operations:
  1. Users --- POST /users for each person (same as above).
  2. Group --- POST /groups with a name. Group name rules: must be non-empty (max 255 chars), must not contain spaces, and must not start with amber (case-insensitive).
  3. Membership --- POST /memberships with group_name and either member_email (the member’s amber login email) or member_group_name (to nest another group). Exactly one of the two must be set.
  4. Document --- allowed_groups: ["engineering"].
Create a group:
Response codes for POST /groups Rename it later with PUT /groups/{datasource}/{group_name}:
Response codes for PUT /groups/{datasource}/{group_name} Add a user as a member (member_email = amber login email):
Or nest one group inside another (member_group_name):
Response codes for POST /memberships Document snippet:

Remove a membership

DELETE /memberships/{datasource}/{group_name}/{member_type}/{member_id} --- member_type is user or group. For user, member_id is the email; for group, it is the nested group’s name.
Response codes for DELETE /memberships/{datasource}/{group_name}/{member_type}/{member_id}
Group membership is transitive. When engineering is a member of all-staff, anyone who is a member of engineering (directly or via further nesting) is also treated as a member of all-staff for access checks.

Verify access

user_email must be the same amber login email you use in /users and permissions. The check resolves the user’s transitive group memberships and compares them to the document’s stored access tokens.
check-access evaluates only the document’s permissions. It does not check whether the user is registered on the datasource with POST /users, which search additionally requires. For example, it returns has_access: true for an anonymous document even if the user has no user record on the datasource --- yet that user will not find the document in search.
Response codes for POST /documents/check-access Remember that newly indexed documents may take up to 2 hours to be committed and become discoverable; check-access queries the search index directly so it will not find a document that is still being processed.

Behaviour notes

  • Permission updates can take a short time to apply everywhere in search. Re-sending a document with changed permissions (and the same last_modified) updates the document without re-extracting binary content (the other fields you send are updated too) --- see Updating a document.
  • Changes to users, groups, and memberships take effect without re-indexing documents: access is resolved when the person searches.
  • If an administrator disables the datasource in amber, none of its documents are shown in search, regardless of permissions.
  • Tighten rules after testing: start with allow_anonymous_access: true (or no permissions) if you need to confirm indexing before locking down. Even then, register your own login email on the datasource with POST /users first --- without a user record you will not see the datasource’s documents, anonymous or otherwise.
  • Renaming a group after documents reference it will leave existing Solr documents pointing at the old name; re-index those documents to apply the new name.