Merge pull request #19327 from resilient-tech/no-share-for-std

This commit is contained in:
Shariq Ansari 2022-12-19 11:07:21 +05:30 committed by GitHub
commit 80da745cf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -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}
)

View file

@ -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

View file

@ -0,0 +1,7 @@
import frappe
import frappe.share
def execute():
for user in frappe.STANDARD_USERS:
frappe.share.remove("User", user, user)