Bench reset-perms fix

After running bench reset-perms all user lost permissions and only login is possible, nothing more.

What can be done to fix permissions?

  • Without sql restore.
  • Only Administrator user working will be fine.

Try to run reload_doctype for all doctypes with reset_permissions=True from bench console.

Also, please raise an issue in github about the issue with bench reset-perms command.

We have found following solution:

  1. Backup the Database using “bench backup --with files”
  2. If you have entered “bench reset-perms” before, the table Dumping Data for “tabDocPerm” in the Database is emty.
  3. Go to a previous backup and copy the part under tabDocPerm / Dumping Data and paste that into the newly created sql Backup using somethign like SQLWorkbench.

– Dumping data for table tabDocPerm
LOCK TABLES tabDocPerm WRITE;
/*!40000 ALTER TABLE tabDocPerm DISABLE KEYS /
“PASTE HERE BEGINNIG WITH INSERT INTO”
/
!40000 ALTER TABLE tabDocPerm ENABLE KEYS */;
UNLOCK TABLES;

  1. Now you can import the Database using "bench --force restore /path2SQLBackup

Now you have the latest data with only permissions restored from another backup.
Good Luck