How to backup and restore a custom role?

How to backup and restore a custom role?

by Vito Zabal -
Number of replies: 3

My task is to create some custom role with original permissions set. So I want to be sure my custom role could be saved and restored in my moodle instanse at any time. Surfing in moodle docs I found this tip http://docs.moodle.org/en/Roles_FAQ#How_do_I_copy_a_custom_role_from_one_Moodle_site_to_another But unfortunatelly this not works for me as I expect. What Im doing:

1. Create my custom new role "test_role"
2. Edit its permissions set (have allowed and prohibited a pair of permittions). Also set a course context type for it.
3. Create new empty course "test_backup_course" for role backuping
4. Manually enroll some test user to "test_backup_course" and set him my custom "test_role" role
5. Backup "test_backup_course" with all backup settings turned on ("Include enrolled users", "Include user role assignments" etc)
6. Delete "test_role" from my moodle instance to be sure that my custom role definetelly will be restored after course restoring from its backup.
7. Restore "test_backup_course" as a new course from backup file created in p5 with all options by default.
8. Get a problem during restoring on Restore role mappings page: "The test_role role in the backup file cannot be mapped to any of the roles that you are allowed to assign."

So I can not really restore my custom role from a course backup. What I do wrong or may be some another way exists to backup/restore custom roles with original permissions set? Thanks.

Average of ratings: -
In reply to Vito Zabal

Re: How to backup and restore a custom role?

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I have a custom role on my site that has restored without problem multiple times.  I have rebuilt my site and then just rebuilt the database from the course backups without issue.  I wonder if deleting the role prior to the backup caused an issue.  I would recommend trying to restore to a clean install of moodle.

This was when I was using 1.9.  I am having a lot of issues with both backup and restore on 2.0.

Emma

In reply to Emma Richardson

Re: How to backup and restore a custom role?

by Vito Zabal -

Yes, I am working with moodle 2.0 version, exactly =(

In reply to Vito Zabal

Re: How to backup and restore a custom role?

by Mark Drechsler -

Hi all,

This definitely looks like something has changed and stopped this work-around from working. I've logged a Tracker item here.

Mark.

Average of ratings: Useful (1)