Merge pull request #19327 from resilient-tech/no-share-for-std
This commit is contained in:
commit
80da745cf6
3 changed files with 14 additions and 4 deletions
|
|
@ -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}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
7
frappe/patches/v13_0/remove_share_for_std_users.py
Normal file
7
frappe/patches/v13_0/remove_share_for_std_users.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import frappe
|
||||
import frappe.share
|
||||
|
||||
|
||||
def execute():
|
||||
for user in frappe.STANDARD_USERS:
|
||||
frappe.share.remove("User", user, user)
|
||||
Loading…
Add table
Reference in a new issue