diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index 1568ae8af3..ac450352e0 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -6,7 +6,7 @@ import frappe import frappe.defaults import frappe.permissions import frappe.share -from frappe import _, msgprint, throw +from frappe import STANDARD_USERS, _, msgprint, throw from frappe.core.doctype.user_type.user_type import user_linked_with_permission_on_doctype from frappe.desk.doctype.notification_settings.notification_settings import ( create_notification_settings, @@ -32,8 +32,6 @@ from frappe.utils.password import update_password as _update_password from frappe.utils.user import get_system_managers from frappe.website.utils import is_signup_disabled -STANDARD_USERS = frappe.STANDARD_USERS - class User(Document): __new_password = None @@ -125,7 +123,8 @@ class User(Document): frappe.enqueue( "frappe.core.doctype.user.user.create_contact", user=self, ignore_mandatory=True, now=now ) - if self.name not in ("Administrator", "Guest") and not self.user_image: + + if self.name not in STANDARD_USERS and not self.user_image: frappe.enqueue("frappe.core.doctype.user.user.update_gravatar", name=self.name, now=now) # Set user selected timezone @@ -237,6 +236,9 @@ class User(Document): ) def share_with_self(self): + if self.name in STANDARD_USERS: + return + frappe.share.add_docshare( self.doctype, self.name, self.name, write=1, share=1, flags={"ignore_share_permission": True} ) diff --git a/frappe/patches.txt b/frappe/patches.txt index 3eca9fd2ac..cf1e509e78 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -182,6 +182,7 @@ frappe.patches.v13_0.update_notification_channel_if_empty frappe.patches.v13_0.set_first_day_of_the_week frappe.patches.v13_0.encrypt_2fa_secrets frappe.patches.v13_0.reset_corrupt_defaults +frappe.patches.v13_0.remove_share_for_std_users execute:frappe.reload_doc('custom', 'doctype', 'custom_field') frappe.patches.v14_0.update_workspace2 # 20.09.2021 frappe.patches.v14_0.save_ratings_in_fraction #23-12-2021 diff --git a/frappe/patches/v13_0/remove_share_for_std_users.py b/frappe/patches/v13_0/remove_share_for_std_users.py new file mode 100644 index 0000000000..39b449995d --- /dev/null +++ b/frappe/patches/v13_0/remove_share_for_std_users.py @@ -0,0 +1,7 @@ +import frappe +import frappe.share + + +def execute(): + for user in frappe.STANDARD_USERS: + frappe.share.remove("User", user, user)