diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index 4c5cea3130..9bcc9ebd3d 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -28,6 +28,7 @@ from frappe.utils import ( now_datetime, today, ) +from frappe.utils.deprecations import deprecated from frappe.utils.password import check_password, get_password_reset_limit from frappe.utils.password import update_password as _update_password from frappe.utils.user import get_system_managers @@ -75,6 +76,7 @@ class User(Document): self.validate_email_type(self.email) self.validate_email_type(self.name) self.add_system_manager_role() + self.populate_role_profile_roles() self.check_roles_added() self.set_system_user() self.set_full_name() @@ -85,7 +87,6 @@ class User(Document): self.remove_disabled_roles() self.validate_user_email_inbox() ask_pass_update() - self.validate_roles() self.validate_allowed_modules() self.validate_user_image() self.set_time_zone() @@ -98,12 +99,16 @@ class User(Document): ): self.set_social_login_userid("frappe", frappe.generate_hash(length=39)) - def validate_roles(self): + def populate_role_profile_roles(self): if self.role_profile_name: role_profile = frappe.get_doc("Role Profile", self.role_profile_name) self.set("roles", []) self.append_roles(*[role.role for role in role_profile.roles]) + @deprecated + def validate_roles(self): + self.populate_role_profile_roles() + def validate_allowed_modules(self): if self.module_profile: module_profile = frappe.get_doc("Module Profile", self.module_profile)