Files
computer-playbook/roles/web-app-keycloak/templates/import/scopes/moodle.json.j2
kevinveenbirkenbachandClaude Opus 4.7 c55ad69c41 refactor: drop requirement-file references from code, add doc rule + lint
Strip every `req <NNN>`, `req-<NNN>`, `Requirement <NNN>`,
`requirement-<NNN>`, and `docs/requirements/<NNN>-...md` mention from
non-Markdown source files. Comments anchored to requirement numbers
rot when requirements are renumbered or rewritten and conflate
present-state behaviour (which the comment should describe) with the
audit trail of how the code got there (which belongs in commit
messages, PR descriptions, and the requirement file itself).

* Document the rule in `docs/contributing/documentation.md` under
  "Comments". Code MUST describe the *why* in present-state language;
  contract enforcement lives in tests, not folklore.
* Clean 254 source files across `roles/`, `tests/`, `plugins/`,
  `cli/`, `scripts/`, `utils/`, `group_vars/`, and the repo-root
  `eslint.config.js`. Pure comment / docstring / log-message edits;
  no behavioural change.
* Add `tests/lint/repository/test_no_req_references_in_code.py` to
  enforce the rule going forward across `.js`, `.py`, `.yml`,
  `.yaml`, `.j2`, and `.sh` files. The legacy
  `test_no_stale_requirement_refs.py` is exempt as the only file
  whose purpose is to detect these very tokens.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 16:25:22 +02:00

43 lines
1.5 KiB
Django/Jinja

{
"name": "{{ lookup('config', application_id, 'services.keycloak.scopes.moodle') }}",
"description": "Custom OIDC claims consumed by Moodle's auth_oidc plugin.",
"protocol": "openid-connect",
"attributes": {
"include.in.token.scope": "true",
"display.on.consent.screen": "true",
"gui.order": "",
"consent.screen.text": ""
},
"protocolMappers": [
{%- set _custom_claims = [
['name_phonetic_given', 'namePhoneticGiven'],
['name_phonetic_family', 'namePhoneticFamily'],
['phone_number_alt', 'phoneNumberAlt'],
['institution', 'institution'],
['department', 'department'],
['description', 'description'],
['id_number', 'idNumber']
] %}
{%- for claim_name, user_attr in _custom_claims %}
{
"name": {{ ('moodle:' ~ claim_name) | to_json }},
"protocol": "openid-connect",
"protocolMapper": "oidc-usermodel-attribute-mapper",
"consentRequired": false,
"config": {
"aggregate.attrs": "false",
"introspection.token.claim": "true",
"multivalued": "false",
"userinfo.token.claim": "true",
"user.attribute": {{ user_attr | to_json }},
"id.token.claim": "true",
"lightweight.claim": "false",
"access.token.claim": "true",
"claim.name": {{ claim_name | to_json }},
"jsonType.label": "String"
}
}{{ "," if not loop.last else "" }}
{%- endfor %}
]
}