Description

Modules support defining subplugins which have their own capabilities in db/access.php
If a sub plugin creates capabilities they get added to the capabilities table and appears in the site permission editing, but the new permissions do not appear as permissions on their parent modules permission page.

I have tested this with Assignment Type and with Workshop Form and behaviour occurs for both. It will create the capabilities but not show them for the module they apply to.

E.g.
To create a test sub-plugin permission I added a capability to the workshop rubric plugin. Code below, and also step increased the version.php to process update.

mod/workshop/form/rubric/db/access.php

<?php

$capabilities = array(

'workshopform/rubric:test' => array(

'captype' => 'write',

'contextlevel' => CONTEXT_MODULE,

'legacy' => array(

'student' => CAP_ALLOW,

'teacher' => CAP_ALLOW,

'editingteacher' => CAP_ALLOW,

)

),

);

mod/workshop/form/rubric/lang/en/workshopform_rubric.php

//Added to lang

$string['rubric:test'] = 'Rubric Test Capability';

After adding this capability, when I brought up the Site Define Roles -> Edit Role the new capability appeared, however if I create a workshop activity and click Permissions these new capabilities do not appear, even though the context is CONTEXT_MODULE.