Skip to content

[docs] Improve documentation around capability contextlevel in the docs #1339

Open
@NeillM

Description

@NeillM

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationhelp wantedExtra attention is neededneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions