How to give by default permissions when user created


when we create user in HRMS Then automatically company and employee user permission apply by default like that
i want to give some doctype permissions by default how to do

@Rahul7218 U can write the server script for that and create user permission for that particular user

Example:

Create server script select after insert event and write this code

user_permission=frappe.new_doc("User Permission")
user_permission.update(
      {
         "user":doc.name,
         "allow":"Employee",
         "for_value":doc.name,
         "apply_to_all_doctypes":1
      }
)
user_permission.insert()
1 Like

ok let me check and back to you