moodle-an-hochschulen / moodle-availability_password

Moodle availability plugin which lets users restrict resources and activities with password access
GNU General Public License v3.0
4 stars 6 forks source link

Type parameter missing in save() #11

Closed christianwolters closed 3 years ago

christianwolters commented 3 years ago

Hi @ll,

the parameter type is missing in https://github.com/moodleuulm/moodle-availability_password/blob/63d662bedf4d1e026917957127b0b8064415c1f3/classes/condition.php#L184

I created a small PR https://github.com/moodleuulm/moodle-availability_password/pull/10

Without this parameter backup/restore is broken, when this availability is used together with other access restrictions, e.g. the relevant part of the json looks like:

"c":[{"password":"PROBE"},{"type":"completion","cm":470,"e":1},{"type":"completion","cm":472,"e":1},{"type":"completion","cm":472,"e":1}] -> no type in first element -> Moodle does not know how to handle this and complains with invalid availability structure error.

Cheers Christian

bendec commented 3 years ago

We also have this problem and at this time we resolve it in the DB when it occurs.

christianwolters commented 3 years ago

Hi @bendec,

you may want to look at the PR: https://github.com/moodleuulm/moodle-availability_password/pull/10/files

It is a really small change you may want to implement as a hotfix on your server.

Cheers Christian

bendec commented 3 years ago

Thanks! We will do this.

lucaboesch commented 3 years ago

This has been released with v3.11-r1 Thanks, Christian!

krostas1983 commented 2 years ago

This issue is still present in v3.9-r3 (actually every release but v3.11-r1). Would be cool if it could be fixed there as well.

As far as I can see, @christianwolters patch / pull request is applicable there as well.

Cheers