Problem course restores and users

Re: Problem course restores and users

by Ken Task -
Number of replies: 2
Picture of Particularly helpful Moodlers

In config-dist.php of version 3.4 ...

// Completely disable user creation when restoring a course, bypassing any
// permissions granted via roles and capabilities. Enabling this setting
// results in the restore process stopping when a user attempts to restore a
// course requiring users to be created.
//     $CFG->disableusercreationonrestore = true;

Have not tried it on any site.   Wonder if this kicks in after having stepped through the beginning of the restore process where person restoring has option to de-select users.

OR if the setting looks for an extracted users.xml in moodledata/temp/backup/[hasheddir]/ and if not blank, then stops the process.

So some 'education' of those that do have ability to restore, might be in order to avoid their frustration, but if they have been informed it will happen and they have to attempt restore again .... well, what can I say ...  If it hurts don't do it! smile

Bout the only way I can think of to avoid any mistake by person restoring, etc. is to edit the xml files in an archive of the backup, removing users, then re-archiving so the restore can proceed without restore user having to think/do anything.

While the above could be automated via bash shell scripts, if one has tons of courses, could take some time.  And, all that could be circumvented if person restoring has a backup of their own in possession .... wouldn't be accessing the file system repo containing the 'scrubbed' .mbz backups.

Since you are in trials, add the line to config and try one restore with users. smile

Depending upon how it behaves you might have to monitor moodledata/temp/backup/ for a while to see it's being cleaned up as it should via cron/task.

'spirit of sharing', Ken


In reply to Ken Task

Re: Problem course restores and users

by Albert Ramsbottom -

I am again back on this as now it appears that

moodle/restore:userinfo, does sort of work insofar as it works then asks the educator to remap the module leader, manager and editing teacher roles to "None"

The odd thing is if i prohibit the

moodle/restore:createuser 

capability, it will not restore the course as the users are missing


ummmmmm


I havent tried the config setting that wil be next

In reply to Albert Ramsbottom

Re: Problem course restores and users

by Ken Task -
Picture of Particularly helpful Moodlers

You could be in-between a rock and a hard place ... IF teachers are to restore old backups.

If all the students (same students) accounts have been established already wouldn't it make sense to restore the courses *without* users/roles and then have the teacher/higher level folk enroll students or have student enroll themselves?

Think I've already suggested that but you desire that teachers NOT have to think ... so that means the other end ... has to be done at server level - without duplicating accounts.

Don't know how server is gonna do that if users exist and the accounts in the backup don't conflict with existing users then it will create new users ... which you don't want (understand that also).

So have you inspected a users.xml file from extracted backup to see what's in columns?   There will be a 'auth' column in users.xml but no password and assuming all other information concerning the students accounts are the same info, what if users.xml was edited and using simple search/replace all 'auth' tags reset from manual to oauth2/openid or what ever it should be now.   User.xml saved.   Files extracted re-packaged as a .mbz.

mbz then made available to teacher for restoring from a file system repo. ... conversion of the backup such as described above done on the server via a bash shell script.

Teachers don't have to think then.

Now you might have to really study what's in users.xml to see if there aren't other tags that need to be changed.

You could try the above with one course and one teacher to see how that goes.

'spirit of sharing', Ken




Average of ratings: Useful (1)