def get_permlevel_access(self):
		if not hasattr(self, "_has_access_to"):
			user_roles = frappe.get_roles()
			self._has_access_to = []
			for perm in self.get_permissions():
				if perm.role in user_roles and perm.permlevel > 0 and perm.write:
					if perm.permlevel not in self._has_access_to:
						self._has_access_to.append(perm.permlevel)

		return self._has_access_to
dataset/ETHPy150Open frappe/frappe/frappe/model/document.py/Document.get_permlevel_access/original