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

TinyMCE: Disable plugins by role

XMLWordPrintable

    • MOODLE_500_STABLE
    • MDL-84126-main
    • Hide

      Tiny native plugin testing

      We only need to test tiny_recordrtc here. All other native plugins have Behat tests.

      1. Log in as admin
      2. Go to Site admin -> Users -> Permissions -> Define roles
      3. Edit the 'Authenicated user' role
      4. Disallow this role from using 'tiny/recordrtc:recordaudio', 'tiny/recordrtc:recordscreen' and 'tiny/recordrtc:recordvideo'
      5. Save changes
      6. Edit the 'Teacher' role
      7. Allow this role to use 'tiny/recordrtc:recordaudio', 'tiny/recordrtc:recordscreen' and 'tiny/recordrtc:recordvideo'
      8. Create a course
      9. Create an assignment that allows 'online text' submissions
      10. Enrol a teacher and a student
      11. Log in as the student
      12. Go to the assignment and click 'Add submission'
      13. Locate the 'Online text' Tiny editor
      14. CONFIRM that there are no 'Record audio' or 'Record video' items in the 'Insert' menu.
      15. Login as the teacher
      16. Go to the assignment settings page
      17. Locate any of the Tiny editors on the page
      18. CONFIRM that you can see 'Record audio' and 'Record video' items in the 'Insert' menu.

      Premium plugins testing

      1. Log in as admin
      2. Go to Site admin -> Plugins -> Text editors -> TinyMCE Premium
      3. Enter in a valid API key (reach out if you need one).
      4. Save changes
      5. Go to Site admin -> Users -> Permissions -> Define roles
      6. Edit the 'Authenicated user' role
      7. Disallow this role from using all plugins with 'tiny/premium:use*******'
      8. Save changes
      9. Edit the 'Teacher' role
      10. Allow this role to use all plugins with 'tiny/premium:use*******'
      11. Log in as the student
      12. Go to the assignment that was created earlier and click 'Add submission'
      13. Locate the 'Online text' Tiny editor
      14. CONFIRM that there are no Tiny Premium plugins loaded
      15. Login as the teacher (best to do this in a separate browser window to help testing next steps)
      16. Go to the assignment settings page
      17. Locate any of the Tiny editors on the page
      18. CONFIRM that you can see all Tiny Premium plugins loaded and that they are performing their correct function*
      19. Go to Site admin -> Plugins -> Text editors -> TinyMCE Premium
      20. Enable and disable plugins and reload the Tiny editor to experiment and see that individual premium plugins are shown/hidden.

      *To confirm that each premium plugin is loaded, it might be best to compare and contrast the items in teacher's editor with the items in the student's editor. To see what each plugin should be doing, you can see all Tiny Premium plugins here: https://www.tiny.cloud/docs/tinymce/latest/plugins/#premium-plugins

      RecordRTC testing

      1. Login as admin
      2. Create a course and enrol a teacher (editingteacher)
      3. Log in as the teacher and create a new 'Page' resource. Locate the 'Page content' text editor
      4. CONFIRM you can see the 'Record audio' and 'Record video' buttons in the TinyMCE toolbar.
      5. Log in as the admin and go to Site admin -> Users -> Define roles
      6. Edit the 'Teacher' role (editingteacher)
      7. Prohibit the role for tiny/recordrtc:use
      8. Log back in as the teacher
      9. Go to the same 'Page content' editor
      10. CONFIRM you cannot see the 'Record audio' and 'Record video' buttons in the TinyMCE toolbar.
      Show
      Tiny native plugin testing We only need to test tiny_recordrtc here. All other native plugins have Behat tests. Log in as admin Go to Site admin -> Users -> Permissions -> Define roles Edit the 'Authenicated user' role Disallow this role from using 'tiny/recordrtc:recordaudio', 'tiny/recordrtc:recordscreen' and 'tiny/recordrtc:recordvideo' Save changes Edit the 'Teacher' role Allow this role to use 'tiny/recordrtc:recordaudio', 'tiny/recordrtc:recordscreen' and 'tiny/recordrtc:recordvideo' Create a course Create an assignment that allows 'online text' submissions Enrol a teacher and a student Log in as the student Go to the assignment and click 'Add submission' Locate the 'Online text' Tiny editor CONFIRM that there are no 'Record audio' or 'Record video' items in the 'Insert' menu. Login as the teacher Go to the assignment settings page Locate any of the Tiny editors on the page CONFIRM that you can see 'Record audio' and 'Record video' items in the 'Insert' menu. Premium plugins testing Log in as admin Go to Site admin -> Plugins -> Text editors -> TinyMCE Premium Enter in a valid API key (reach out if you need one). Save changes Go to Site admin -> Users -> Permissions -> Define roles Edit the 'Authenicated user' role Disallow this role from using all plugins with 'tiny/premium:use*******' Save changes Edit the 'Teacher' role Allow this role to use all plugins with 'tiny/premium:use*******' Log in as the student Go to the assignment that was created earlier and click 'Add submission' Locate the 'Online text' Tiny editor CONFIRM that there are no Tiny Premium plugins loaded Login as the teacher (best to do this in a separate browser window to help testing next steps) Go to the assignment settings page Locate any of the Tiny editors on the page CONFIRM that you can see all Tiny Premium plugins loaded and that they are performing their correct function* Go to Site admin -> Plugins -> Text editors -> TinyMCE Premium Enable and disable plugins and reload the Tiny editor to experiment and see that individual premium plugins are shown/hidden. *To confirm that each premium plugin is loaded, it might be best to compare and contrast the items in teacher's editor with the items in the student's editor. To see what each plugin should be doing, you can see all Tiny Premium plugins here: https://www.tiny.cloud/docs/tinymce/latest/plugins/#premium-plugins RecordRTC testing Login as admin Create a course and enrol a teacher (editingteacher) Log in as the teacher and create a new 'Page' resource. Locate the 'Page content' text editor CONFIRM you can see the 'Record audio' and 'Record video' buttons in the TinyMCE toolbar. Log in as the admin and go to Site admin -> Users -> Define roles Edit the 'Teacher' role (editingteacher) Prohibit the role for tiny/recordrtc:use Log back in as the teacher Go to the same 'Page content' editor CONFIRM you cannot see the 'Record audio' and 'Record video' buttons in the TinyMCE toolbar.
    • Hide

      Code verified against automated checks with warnings.

      Checked MDL-84126 using repository: https://github.com/davewoloszyn/moodle.git

      Should these errors be fixed?

      Built on: Wed Feb 26 06:01:44 AM UTC 2025

      Show
      Code verified against automated checks with warnings. Checked MDL-84126 using repository: https://github.com/davewoloszyn/moodle.git main (0 errors / 1 warnings) [branch: MDL-84126-main | CI Job ] overview (0/0) , phplint (0/0) , phpcs (0/0) , js (0/0) , css (0/0) , phpdoc (0/0) , commit (0/1) , savepoint (0/0) , thirdparty (0/0) , externalbackup (0/0) , grunt (0/0) , shifter (0/0) , mustache (0/0) , gherkin (0/0) , Should these errors be fixed? Built on: Wed Feb 26 06:01:44 AM UTC 2025
    • Show
      Launching automatic jobs for branch MDL-84126 -main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18380/ PHPUnit (sqlsrv / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/62950/ Behat (NonJS - boost and classic / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/62951/ Behat (Firefox - boost / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/62952/ Behat (Firefox - classic / complete) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/62953/ App tests (stable app version) / complete) Built on: Fri Feb 28 01:13:19 UTC 2025
    • 6
    • Team Hedgehogs 2025 Sprint 1.1, Team Hedgehogs 2025 Sprint 1.2

      The way the pricing model for the TinyMCE premium plugins works is by number of editor impressions/loads. Also, currently there is no way to restrict plugins by role.

      So that means if you enable a premium plugin right now, it loads for every user type: students, teachers, managers, etc. Which means that you can't make a premium plugin available to just teachers for example. As there are certain plugins that may only be of use or appropriate for teachers, and orgs shouldn't need to pay for students (who don't use that tool) to have access.

      The likely easiest way forward here would be to add a "use" capability to every premium plugin for TinyMCE and then update the editor plugins to check for this capability.

      While we at it, for completeness we should also make sure the equivalent capabilities exist for the core LMS TinyMCE plugins

        1. (1) 14 Passed -- (Main)MDL-84126.png
          101 kB
          Kim Jared Lucas
        2. (1) 18 Passed -- (Main)MDL-84126.png
          100 kB
          Kim Jared Lucas
        3. (2) 14 Passed -- (Main)MDL-84126.png
          73 kB
          Kim Jared Lucas
        4. (2) 18 Passed -- (Main)MDL-84126.png
          95 kB
          Kim Jared Lucas
        5. (3) 10 Passed -- (Main)MDL-84126.png
          117 kB
          Kim Jared Lucas
        6. (3) 4 Passed -- (Main)MDL-84126.png
          80 kB
          Kim Jared Lucas
        7. show-advanced.png
          57 kB
          David Woloszyn
        8. ss-capabilities.png
          189 kB
          David Woloszyn
        9. teacher-role.png
          111 kB
          David Woloszyn
        10. teacher-role-1.png
          111 kB
          David Woloszyn

            david.woloszyn@moodle.com David Woloszyn
            matt.porritt@moodle.com Matt Porritt
            Meirza Meirza
            Safat Shahin Safat Shahin
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day, 3 hours, 19 minutes Original Estimate - 1 day, 3 hours, 19 minutes
                1d 3h 19m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days, 5 hours, 47 minutes
                4d 5h 47m

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