moodle / moodle/devdocs

[docs] Improve documentation around capability contextlevel in the docs

Open
#1,339 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug documentation help wanted needs-triage
Dominant language
TypeScript
Stars
74
Forks
652
Avg merge
2d 50m
Merged PRs (30d)
12

Description

What is the URL of the page?

https://moodledev.io/docs/5.0/apis/subsystems/access#how-to-define-new-capabilities-in-plugins

What is the issue with this page?

In the dev chat there was a discussion around what contextlevel on capabilities does and means we seemed to come up with a good description that is not included in the docs at the moment:

It indicates what context you intend to check the capability at, and does control where it appears, for instance moodle/site:config is defined as CONTEXT_SYSTEM and that means you can't change it at lower levels. If you go to a course (or category, or module or block, or user for that matter) and try to override capabilities there, that one doesn't show on the list. Because if you did override it in a course, it wouldn't make any difference when you check it as context system.

It seems that adding this or something similar will help people understand what contextlevel they should choose to use better.

Are you able to provide a patch for this?

If no one picks this up sooner, I'll likely do it next week

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the linked capability documentation page and start at “How to define new capabilities in plugins,” reviewing the existing contextlevel guidance. Add a clear explanation of what contextlevel controls, including why system-level capabilities cannot be overridden lower in the context hierarchy, then verify the rendered documentation.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.