Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-25316

Capabilities created by Sub Plugins do not show on Permissions page for that module

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      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.

        Attachments

          Activity

            People

            • Assignee:
              mudrd8mz David Mudrák (@mudrd8mz)
              Reporter:
              rudd_j James Rudd
              Tester:
              Nobody
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Dec/10