No permissions after bench --site all reset-perms

I received these two error messages when I ran bench --site erp reset-perms.

/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/async_task/async_task.json missing
/home/frappe/frappe-bench/apps/erpnext/erpnext/schools/doctype/scheduling_tool/scheduling_tool.json missing

Now all users have no permission. This includes the Administrator account. I can login but have permission to do nothing.

Hi @akrause,

Can you share the version of apps?

Installed Apps

ERPNext: v7.2.8

Frappe Framework: v7.2.8

I have been using ERPNext for about a year and updating regularly. I ran bench reset-perms because I suspect I had a permission problem before. I have been unable to access Accounts->Tools->Bank Reconciliation.

Hi @akrause,

do bench mysql, run below query and share the output
select count(*) from tabDocType where name in (‘Async Task’, ‘Scheduling Tool’)

The result of the query is
count(*) = 2

I have the same problem, after running bench reset-perms I don’t have access to any module, even with the administrator user. Is there any solution for this problem?

I also encounter this problem. I have created an issue in github

I have notice the code in reset-perms its just deleting all records in tabDocPerm that is istable=0 and custom=0.
Would that be the reason that even Administrator has no access because DocPerm is empty?

def reset_perms(doctype):
	"""Reset permissions for given doctype."""
	from frappe.desk.notifications import delete_notification_count_for

	frappe.db.sql("""delete from tabDocPerm where parent=%s""", doctype)
	frappe.reload_doc(frappe.db.get_value("DocType", doctype, "module"),
		"DocType", doctype, force=True)

We have found following solution:

Backup the Database using "bench backup --with files"If you have entered “bench reset-perms” before, the table Dumping Data for “tabDocPerm” in the Database is emty. 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
/*!40000 ALTER TABLE tabDocPerm DISABLE KEYS /
!40000 ALTER TABLE tabDocPerm ENABLE KEYS */;

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