get unlinked user data
This commit is contained in:
parent
e7ac5a2807
commit
da5dad810f
1 changed files with 15 additions and 1 deletions
|
|
@ -9,4 +9,18 @@ from frappe.model.document import Document
|
|||
from frappe.desk.form.linked_with import get_linked_doctypes
|
||||
|
||||
class PersonalDataDownloadRequest(Document):
|
||||
pass
|
||||
def after_insert(self):
|
||||
if self.user in ['Administrator', 'Guest']:
|
||||
frappe.throw(_("This user cannot request to download data"))
|
||||
else:
|
||||
personal_data = get_unlinked_user_data(self.user)
|
||||
|
||||
def get_unlinked_user_data(user):
|
||||
""" returns user data not linked to User doctype """
|
||||
hooks = frappe.get_hooks("user_privacy_documents")
|
||||
data = {}
|
||||
for hook in hooks:
|
||||
d = frappe.get_all(hook.get('doctype'), {hook.get('email_field'): user},["*"])
|
||||
if d:
|
||||
data.update({ hook.get('doctype'):d })
|
||||
return data
|
||||
Loading…
Add table
Reference in a new issue