How to ignore permissions when using frappe. get.doc ('User ')?

How to allow users to use get doc to retrieve the User table in certain situations, as they usually do not have access to the User table, and successfully use these codes like :
user = frappe.get_doc(‘User’, guest_email)
user.set(‘block_modules’, )
user.set(‘roles’, )

Just like the effect of these codes, successfully modifying the sub doctype data?

use it.

user.flags.ignore_permissions = True

thx reply. but… users do not have permission to access the User table, and an error occurs when get.doc ('User ') is used. Therefore, if the user variable is not successfully assigned, this flag cannot be used.