ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Setting Default Role on user sign up

customization
frappe

#1

Hello,

Is there a way of setting a default Role e.g Customer with desk access and other access rights so that everyone who signs up get assigned to that Role by default.

Maybe even assigning that default role when posting a new user through REST API.

Kr,
Oasis


#2

See Portal Settings


#3

Where can I set the default role for users signing up with LDAP? It is currently “Blogger”. We want to have them as webshop customers, as all customers are in LDAP.

New LDAP users seem to be hardcoded to become a “Blogger” in https://github.com/frappe/frappe/blob/387f556dd5c241fa3b223884ce7e3a79f864c9c1/frappe/integrations/doctype/ldap_settings/ldap_settings.py#L133

PROPOSAL: add “Default role for new user” to LDAP settings DocType

Workaround done: add to role blogger the permissions “Request” und “Invoice” and remove permission to use desktop


#4

After migrating to v11, by adding all permissions of the role “Customer” to “Blogger” seems not to be sufficient anymore to allow a “Blogger” to finish an order in the webshop. It ends up with a window showing “Customer” - required to login. But the user had already logged in.

SO-not-allowed

I finally made it working by patching frappe/integrations/doctype/ldap_settings/ldap_settings.py#L133 and replacing Blogger with Customer


#5

I’m just getting some ldap changes merged at the moment, but your idea is a good one, I’ll submit a pr with this as an option


#6

@cjpit I submitted already a PR https://github.com/frappe/frappe/pull/7448 - maybe this simple one is then obsolete.

However, it turns out, that a new user with role “customer” has to exist in ERPnext before user can login. This restriction (which we do not have for the role “blogger”) does not allow to sign up. No idea where this is being configured, definetely not in the permissions list.

Remember, our use case is allowing LDAP users to sign up first time when ordering an item in the web shop.


#7

Hi @rasos , I’d make the option generic, so you can choose what role you want the user to be on creation/login. We also have a requirement to map ldap roles to erpnext roles, so I’ll add that option as well.