Skip to content

feat(viewer): list the roles and grants in force and mark a policy party (#6644) - #6683

Queued
rubentalstra wants to merge 17 commits into
mainfrom
feat/viewer-roles-grants
Queued

rubentalstra wants to merge 17 commits into
mainfrom
feat/viewer-roles-grants

Conversation

@rubentalstra

Copy link
Copy Markdown
Member

Closes #6644

This branch builds on #6669 (#6642, the access policy page) and carries its commits until that PR merges. Review only the commits after it.

Roles and grants (/grants, console group) lists the policy parties for an administrator. It reads them through AQL rooted at ROLE, AGENT and PARTY_RELATIONSHIP, so the CDR's policy-party rule decides what is shown. An administrator reads every policy party. Any other caller gets an empty answer, which the page draws as "no role holds a grant". A 403 says the account may not read grants. No openEHR specification governs grants: this is FerroEHR's own design over its draft access control package.

  • Roles holding a grant: SELECT DISTINCT r FROM ROLE r CONTAINS CAPABILITY c CONTAINS ELEMENT e WHERE e/value/defining_code/terminology_id/value = 'openehr_access'. Each row shows:
    • the grant codes with their rubrics: the element values coded in openehr_access;
    • the terms that qualify them: the elements whose name is such a code, for example scope or binding_issuer;
    • the performer, linked to its party;
    • the role's and each capability's time_validity;
    • whether the grant is in force now. That reads the two validities on today's UTC date, plus not_before and not_after, as the book's "How a request reads its grants" describes.
  • System agents: the actors carrying an element named openehr_access::client_id, with the client id and issuer. The provider each acts for comes from the openehr_access::acts_for relationships.
  • How a grant changes: the page says a grant is given and ended by a new version of the ROLE, written in the party editor. Each row opens its role.
  • Party page mark: the Overview of a policy party carries a Policy party section with the client the party binds and the grants its roles carry. For a ROLE these come from its own document; for an actor, from AQL on r/performer/id/value.

The recorder now makes its user the first administrator (FERROEHR__AUTHZ__RBAC__FIRST_ADMIN=ferroehr), so the user reads the policy parties. It also grants a system client read_change_feed and writes that client's acts-for relationship to the clinic. Both grants are the recording's own and are admitted only by the recorder's test ceiling.

Tests

  • ssr_app::grants runs over the re-recorded CDR. It covers the list (write_access_policy, read_change_feed, hold_scopes, the system agent, its issuer and its provider), a 403, and the mark on an agent's page and a role's page. It also checks that an ordinary person page carries no mark.
  • e2e_grants (a browser journey) lists the grants the e2e lane gives its SCIM clients and Basic users, then opens the basic-users agent and finds its mark.
  • Docs shots: /grants. Unit tests cover the role and agent readings, the in-force rule and the mark.

Docs

  • The book's viewer/access-control.md has a Roles and grants section, and the viewer index lists the page.
  • Changelog fragment 6644-viewer-roles-grants.added.md.

A new Access policy page in the console group draws the controller's
ACCESS_POLICY in force by section, each coded value with its rubric and
code; its Versions tab lists every version and opens any one read-only;
an administrator edits the whole policy in the code editor, saved with
If-Match naming the version read (If-None-Match: * for the first). While
none is committed the page says nothing is tightened; a 403 and an admin
API that is off are drawn as such.

The recorder of the replayed CDR provisions its user with the four
arguments scim-provision.sh takes, takes its container name from the
environment, and seeds two versions of the policy under a
write_access_policy grant its own test ceiling admits; the e2e lane seeds
the same for its journey.
…ave words

The access policy editor, Edit as a new version and the party editors
share Unsaved, editor_line, save_as_words and reload_words in
pages::common, and Access policy words an attribute as Configuration
does; the book page names its audience.
…hic class (#6644)

The allow line for the AQL the viewer sends the CDR matches each FROM
root AQL defines, EHR and the demographic classes, so the roles and grants
queries pass and any other string that starts with SELECT is still read.
@rubentalstra

Copy link
Copy Markdown
Member Author

The stray-literals allow line for AQL now matches AQL's own FROM roots, ^SELECT .+ FROM (EHR|PARTY|PERSON|ORGANISATION|GROUP|ROLE|AGENT|PARTY_RELATIONSHIP)([^A-Z_]|$), replacing ^SELECT .+ FROM EHR. It keeps the reason "AQL query text the viewer sends the CDR, never drawn". The orchestrator approved it. AQL query text is not reader text, and any other string that only starts with SELECT is still caught. The guard reads the allow file with awk, so the word boundary is written ([^A-Z_]|$), not \b.

pages::common may not grow past its recorded length, so the editor
helpers move to a module of their own.
…ver a version

pages::editor::document_form docks the decision bar and draws the refusal,
the code editor and its findings; the access policy editor takes it, and
Access policy reads an instant through one pages::policy::instant.
@rubentalstra
rubentalstra added this pull request to the merge queue Nov 26, 2026
Any commits made after this event will not be merged.
# Conflicts:
#	app/ferroehr-viewer/locales/policy/en/policy.ftl
#	app/ferroehr-viewer/locales/shell/en/shell.ftl
#	app/ferroehr-viewer/src/locale/policy.rs
#	app/ferroehr-viewer/src/pages/policy/mod.rs
#	app/ferroehr-viewer/src/routes.rs
#	app/ferroehr-viewer/src/shell.rs
#	app/ferroehr-viewer/tests/fixtures/cdr/manifest.json
#	app/ferroehr-viewer/tests/fixtures/cdr/recording.json
#	app/ferroehr-viewer/tests/it/e2e_docs_shots.rs
#	app/ferroehr-viewer/tests/it/ssr_app.rs
#	scripts/viewer-record.sh
#	website/book/src/viewer/access-control.md
#	website/book/src/viewer/index.md
@rubentalstra
rubentalstra removed this pull request from the merge queue due to a manual request Nov 26, 2026
@rubentalstra
rubentalstra added this pull request to the merge queue Nov 26, 2026
Any commits made after this event will not be merged.
# Conflicts:
#	app/ferroehr-viewer/src/locale.rs
#	scripts/checks/stray-literals.allow
@rubentalstra
rubentalstra removed this pull request from the merge queue due to a manual request Nov 26, 2026
@rubentalstra
rubentalstra added this pull request to the merge queue Nov 26, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The viewer lists the roles and grants in force and marks a policy party

1 participant