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

Add Admin UI to manually upload H5P content-type libraries

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      • Requires access to DB for testing. The easiest way to check content libraries loaded in the system, is querying 'mdl_h5p_libraries' table using:

      select * from mdl_h5p_libraries

      Test 1 (User must have proper permission in order to manage h5p content libraries)

      1. Login as Admin.
      2. Create 2 users (user1 and user2)
      3. Assign the 'Manager' system role to user2.
      4. Login as user1.
      5. Go to (path_to_your_instance)/h5p/libraries.php
        1.  make sure you cannot access this page and an error message is displayed ("Sorry, but you do not currently have permissions to do that (Allow to update H5P content-type libraries).)"
      6. Login as user2 (manager).
      7. Go to (path_to_your_instance)/h5p/libraries.php
        1. make sure you can access this page and a form to manage the h5p content is displayed.
      8. Login as Admin.
      9. Edit the 'Manager' role. (Site administration > Users > Permissions > Define roles)
        1. Remove the moodle/h5p:updatelibraries capability for this role
      10. Login as user2 (manager)
      11. Go to (path_to_your_instance)/h5p/libraries.php
        1. make sure you cannot access this page and an error message is displayed ("Sorry, but you do not currently have permissions to do that (Allow to update H5P content-type libraries).)"

       

      Test 2 (upload new content libraries)

      1. Login as Admin
      2. Go to Site administration -> H5P -> Manage H5P
      3. In the 'H5P content package' filearea upload the course-presentation.h5p file
        1. make sure a 'success' notification is displayed ("H5P libraries uploaded successfully")
        2. make sure the content libraries have been successfully uploaded.
          1. make sure each library from the file has it's own record in the db table h5p_libraries.

      SELECT * FROM mdl_h5p_libraries

      Following libraries should be in the result: blob, downloadify, Drop, EmbeddedJS, filesaber, flowplayer, FontAwesome, H5P.AdvancedText, H5P.Appearin, H5P.Audio, H5P.Blanks, H5p.CKEditor, H5P.ContinuousText, H5P.CoursePresentation, H5P.Dialogcards, H5P.DragNBar, H5P.DragNDrop, H5P.DragNResize, H5P.DragText, H5PEditor.ColorSelector

      Take a notice of the H5P.Audio library in the db, it should have majorversion = 1 and minorversion = 3 

       

      Test 3 (update a specific content library) 

      (Continue after uploading the new content libraries from Test 2)

      1. In the 'H5P content package' filearea upload the course-presentation-updated.h5p file
        1. make sure a 'success' notification is displayed ("H5P libraries uploaded successfully")
        2. make sure the content libraries have been successfully uploaded.
          1. make sure each library from the file has it's own record in the db table h5p_libraries.

      SELECT * FROM mdl_h5p_libraries

      Following libraries should be in the result: blob, downloadify, Drop, EmbeddedJS, filesaber, flowplayer, FontAwesome, H5P.AdvancedText, H5P.Appearin, H5P.Audio, H5P.Blanks, H5p.CKEditor, H5P.ContinuousText, H5P.CoursePresentation, H5P.Dialogcards, H5P.DragNBar, H5P.DragNDrop, H5P.DragNResize, H5P.DragText, H5PEditor.ColorSelector

      take a notice of the H5P.Audio library in the db, a new record has been created representing the new version of the H5P.Audio library (1.5)

       

      Test 4 (upload a zip file containing libraries data)

      1. In the 'H5P content package' filearea upload the essay.zip file
        1. make sure a 'success' notification is displayed ("H5P libraries uploaded successfully") 
        2. make sure the content libraries have been successfully uploaded.   
          1. make sure each library from the file has it's own record in the db table h5p_libraries.

      SELECT * FROM mdl_h5p_libraries

      Following libraries should be in the result: Drop, FontAwesome, H5PEditor.RangeList, H5PEditor.ShowWhen, H5PEditor.TableList, H5PEditor.VerticalTabs, H5P.Essay

       

      Test 5 (upload an invalid file or a zip file with an invalid content) 

      1. In the 'H5P content package' filearea upload the TestZipRandom .zip file
        1. make sure an 'error' notification is displayed ("Invalid H5P content package.")
      2. In the 'H5P content package' filearea attempt to upload a random .jpg (random format excluding .h5p or .zip) file
        1. make sure the file could not be uploaded in the filearea and an alert is displayed stating the filetype cannot be accepted 
      Show
      Requires access to DB for testing. The easiest way to check content libraries loaded in the system, is querying 'mdl_h5p_libraries' table using: select * from mdl_h5p_libraries Test 1 (User must have proper permission in order to manage h5p content libraries) Login as Admin. Create 2 users (user1 and user2) Assign the 'Manager' system role to user2. Login as user1. Go to (path_to_your_instance)/h5p/libraries.php   make sure you cannot access this page and an error message is displayed ("Sorry, but you do not currently have permissions to do that (Allow to update H5P content-type libraries).)" Login as user2 (manager). Go to (path_to_your_instance)/h5p/libraries.php make sure you can access this page and a form to manage the h5p content is displayed . Login as Admin. Edit the 'Manager' role. (Site administration > Users > Permissions > Define roles) Remove the moodle/h5p:updatelibraries capability for this role Login as user2 (manager) Go to (path_to_your_instance)/h5p/libraries.php make sure you cannot access this page and an error message is displayed ("Sorry, but you do not currently have permissions to do that (Allow to update H5P content-type libraries).)"   Test 2 (upload new content libraries) Login as Admin Go to Site administration -> H5P -> Manage H5P In the 'H5P content package' filearea upload the course-presentation.h5p file make sure a 'success' notification is displayed ("H5P libraries uploaded successfully") make sure the content libraries have been successfully uploaded. make sure each library from the file has it's own record in the db table h5p_libraries. SELECT * FROM mdl_h5p_libraries Following libraries should be in the result: blob, downloadify, Drop, EmbeddedJS, filesaber, flowplayer, FontAwesome, H5P.AdvancedText, H5P.Appearin, H5P.Audio, H5P.Blanks, H5p.CKEditor, H5P.ContinuousText, H5P.CoursePresentation, H5P.Dialogcards, H5P.DragNBar, H5P.DragNDrop, H5P.DragNResize, H5P.DragText, H5PEditor.ColorSelector Take a notice of the H5P.Audio library in the db, it should have majorversion = 1 and minorversion = 3     Test 3 (update a specific content library)   (Continue after uploading the new content libraries from Test 2) In the 'H5P content package' filearea upload the course-presentation-updated.h5p file make sure a 'success' notification is displayed ("H5P libraries uploaded successfully") make sure the content libraries have been successfully uploaded. make sure each library from the file has it's own record in the db table h5p_libraries. SELECT * FROM mdl_h5p_libraries Following libraries should be in the result: blob, downloadify, Drop, EmbeddedJS, filesaber, flowplayer, FontAwesome, H5P.AdvancedText, H5P.Appearin, H5P.Audio, H5P.Blanks, H5p.CKEditor, H5P.ContinuousText, H5P.CoursePresentation, H5P.Dialogcards, H5P.DragNBar, H5P.DragNDrop, H5P.DragNResize, H5P.DragText, H5PEditor.ColorSelector take a notice of the H5P.Audio library in the db, a new record has been created representing the new version of the H5P.Audio library (1.5)   Test 4 (upload a zip file containing libraries data) In the 'H5P content package' filearea upload the essay.zip file make sure a 'success' notification is displayed ("H5P libraries uploaded successfully")   make sure the content libraries have been successfully uploaded.     make sure each library from the file has it's own record in the db table h5p_libraries. SELECT * FROM mdl_h5p_libraries Following libraries should be in the result: Drop, FontAwesome, H5PEditor.RangeList, H5PEditor.ShowWhen, H5PEditor.TableList, H5PEditor.VerticalTabs, H5P.Essay   Test 5 (upload an invalid file or a zip file with an invalid content)   In the 'H5P content package' filearea upload the TestZipRandom .zip file make sure an 'error' notification is displayed ("Invalid H5P content package.") In the 'H5P content package' filearea attempt to upload a random .jpg (random format excluding .h5p or .zip) file make sure the file could not be uploaded in the filearea and an alert is displayed stating the filetype cannot be accepted  
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-67059-master
    • Sprint:
      H5P Sprint Relase 3.8

      Description

      Whilst reviewing the H5P integration (MDL-66609) an issue has been raised to control who can install/update the content-type libraries.

      That's why admins/managers need a simple UI to manually upload any content or content type library version.

        Attachments

        1. course-presentation.h5p
          4.14 MB
        2. course-presentation-updated.h5p
          4.14 MB
        3. essay.zip
          643 kB
        4. image-2019-10-31-12-14-21-389.png
          image-2019-10-31-12-14-21-389.png
          103 kB
        5. Screenshot 2019-11-04 at 13.29.57.png
          Screenshot 2019-11-04 at 13.29.57.png
          319 kB
        6. Test1_Screenshot.png
          Test1_Screenshot.png
          178 kB
        7. Test2_Screenshot.png
          Test2_Screenshot.png
          173 kB
        8. Test3_Screenshot.png
          Test3_Screenshot.png
          127 kB
        9. Test4 and 5_Screenshot.png
          Test4 and 5_Screenshot.png
          410 kB
        10. TestZipRandom.zip
          110 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 7 hours
                  1d 7h