moodle-mod_hvp icon indicating copy to clipboard operation
moodle-mod_hvp copied to clipboard

Error loading libraries for non-teachers

Open snack753 opened this issue 4 years ago • 7 comments

Hi there, I have a customer who uses H5P in Moodle 3.8.2. Having the role "Manager" in a course he is able to create new H5P activities and to set everything up. However, after saving: when he tries to edit the activity again he gets the error: unable to load libraries in the H5P section of the editing page. the rest of the course editing page works as expected. Adding the teacher role to his user account in the affected courses solves this issue. Looking at the role definition the manager has even more rights in the H5P section like the teacher. Have the impression there is a bug somewhere in the role definition of the activity.

snack753 avatar May 15 '20 04:05 snack753

Please enable php error logging/debugging for Moodle to see if you're getting any errors: https://h5p.org/documentation/troubleshooting-php#php-error-log-header

thomasmars avatar May 15 '20 09:05 thomasmars

Error message stays the same: no additional debugging information: image

snack753 avatar May 15 '20 09:05 snack753

can you check the response from the 'content-type-cache' or 'libraries' request in the network tab in the developer tools/console of your browser ?

thomasmars avatar May 15 '20 13:05 thomasmars

The console says: [Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (ajax.php, line 0) http:///mod/hvp/ajax.php?contextId=177&token=c70a9b8fae4fb&action=content-type-cache

In the network tab it says: ajax.php: { "success": false, "message": "You do not have permission to view the content types." }

Summary URL: http://academy.kumonkea.com/mod/hvp/ajax.php?contextId=177&token=c70a9b8fae4fb&action=content-type-cache Status: 403 Forbidden Source: Network Address: 85.214.189.226:80 Initiator: jquery.js:4:17824

Request GET /mod/hvp/ajax.php HTTP/1.1 Cookie: MOODLEID1_=%259D%25DA55%25FD%2526G; MoodleSession=jchd35ff521k6j5aubflt62e1a Accept: / Host: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15 Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: keep-alive X-Requested-With: XMLHttpRequest

Response HTTP/1.1 403 Forbidden Transfer-Encoding: Identity Content-Type: application/json; charset=utf-8 Pragma: no-cache Cache-Control: no-cache Date: Fri, 15 May 2020 15:24:54 GMT Keep-Alive: timeout=5, max=95 Expires: Thu, 19 Nov 1981 08:52:00 GMT Connection: Keep-Alive X-Powered-By: PHP/7.3.17, PleskLin Server: Apache

Query String Parameters contextId: 177 token: c70a9b8fae4fb action: content-type-cache

Is this sufficient?

snack753 avatar May 15 '20 15:05 snack753

Yes, it appears the user does not have enough privileges for the action they're performing. Make sure the user has the mod/hvp:addinstance capability if this is within the context of a course or the mod/hvp:manage capability if outside a course context.

thomasmars avatar May 18 '20 12:05 thomasmars

Hi, I have the same problem: with the admin account, the libraries are loaded, with the user account, they are not. However, the capabilities are set correctly. Any more ideas? Thank you!

lassnj avatar Mar 30 '22 07:03 lassnj

Hi there, are there any updates on this? We are now a couple of years later and I still have this issue ...

snack753 avatar Mar 13 '24 16:03 snack753