Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5561

Dataform capabilities breaks "Edit roles by capability" plugin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.8.5
    • 2.7.3, 2.8
    • Set: Dataform
    • None

      Because of the way that the capabilities array is constructed, it breaks the usage of the Edit roles by capability plugin: https://moodle.org/plugins/view.php?plugin=tool_editrolesbycap

      Stack trace:

      Fatal error: Cannot redeclare mod_dataform_capabilities_dataform() (previously declared in /usr/local/moodle/releases/2.x/mod/dataform/db/access.php:42) in /usr/local/moodle/releases/2.x/mod/dataform/db/access.php on line 42

      Call Stack
      #	Function	Location
      1	{main}( ) ../index.php:0
      2	tool_editrolesbycap_load_role_definitions( )	../index.php:67
      3	tool_editrolesbycap_get_default_permission( )	../locallib.php:103
      4	get_default_capabilities( )	../locallib.php:67
      5	load_capability_def( )	../accesslib.php:2601
      

      The problem is when accesslib.php: load_capability_def( ) is called it calls require on the db/access.php file. Since this is called multiple times per role we get a "Cannot redeclare" error.

      A possible fix could be to not make the access.php file use functions, but just have re-defined arrays. Or move the functions to another include file that is included only once.

            itamart Itamar Tzadok (Inactive)
            rex Rex Lorenzo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.