I want to run this script for those user whose role profile is crm channel partner

frappe.listview_settings[‘Lead’] = {
onload: function(listview) {
frappe.call({
method: “frappe.client.get_value”,
args: {
doctype: “User”,
filters: { name: frappe.session.user },
fieldname: [“role_profile_name”]
},
callback: function(response) {
if (response && response.message) {
var role_profile = response.message.role_profile_name;

                // Check if the role profile is 'CRM Channel Partner'
                if (role_profile === "CRM Channel Partner") {
                    // Apply filter for the current logged-in user
                    frappe.route_options = {
                        _assign: ["like", frappe.session.user]
                    };
                    listview.refresh();
                }
            }
        }
    });
}

}; this script is correct?
i want apply filter assign to user name those user whose role profile is crm channel partner but script not work

Auto assignment rule can do that I think.

@TurkerTunali yes you are correct i have do with assignment rule but what problem i faced that assign lead to that assigned user cannot edit any fields
Insufficient write permission error occur
But i have give all permission to that user like read, write, create, delete, import,email,export