Why is user_id = email address?

Why does user_id have to be an email? This seems like a poor design decision that has many negative consequences, to list a few:

1. :email: The Activity Timeline exposes everyone’s login emails

  • As a non-admin, you can’t see the name of the people who interacted with a record because you don’t have access to ‘Read’ the whole User doctype

  • OK… security I guess… but on the other hand, frappe shows you, with no hesitation, everyone’s personal emails instead of their names :man_facepalming:

This removes the only necessary piece of meaningful context from the Activity Timeline:
basement_crawler743@gmail.com last edited this

…basement WHO??

2. :books: Additional database storage

  • Email addresses take up significantly more database storage - varchar(140)

  • Each record, on each doctype contains the email in at least 2 columns (owner & modified_by) - frappe databases are totally FLOODED with repetitive email addresses

3. :snail: Additional performance overhead

  • Lookups, indexes and everything else is more expensive when working with email addresses

4. :face_with_spiral_eyes: Additional maintenance overhead

  • When something completely harmless happens - someone changing their email address:

  • Frappe has to go through the entire database, for each email change to replace the old email with the new one, in every single table, across multiple fields

  • To put this into perspective, blank Frappe Framework has ~250 tables, ERPNext + HRMS has about ~850 tables (doctypes)

  • This is highly inefficient and doesn’t add anything that a username wouldn’t

5. :man_shrugging: It makes no sense that email is mandatory, but username is not

  • Especially since you can enable login via username with 1 click in settings: so the link between username → email is already created

6. :office_worker: Complicated to setup in conjunction with the concept of an ‘Employee’

  • When something as trivial as an email change happens, there is a LOT of additional overhead to manage
  1. By frappe for internal renaming of emails across the whole database
  2. By yourself if you have added any additional functionality
  3. In the case of ERPNext (+HRMS) it is entirely confusing and a pain to manage because there is ‘personal_email’, ‘company_email’, ‘preferred_email’ AND ‘user_email’…

7. :arrows_counterclockwise: Emails are NOT a static piece of data, they can and do change


Personally, I am more inclined towards user id being an actual UUID or BIGINT, but I also respect Frappe’s philosophy to use meaningful strings/names for identifiers - so username would provide the best of all worlds, to name a few advantages:

PROs of Username as User ID:

  1. They almost never change

  2. Are more meaningful:
    john_doe8832 vs big_boss_ceo@iboughtthisdomainforverycheapandiloveit.com
    (12 chars vs 56 chars, and frappe emails can go up to 140 characters)

  3. Can be standardized according to system policies (i.e. firstname_lastname_4digitnumber)

  4. Are more unique

  5. Better performance for indexing and lookups

  6. Use less database storage (even varchar(20) which is still very permissive, would be 7x better than varchar(140) email)

  7. Users can change their emails all they want, with near zero impact on the system

  8. Links are less prone to changes


And lastly, think about the following:

  • How many times have you changed your username on any forum/website?

  • What about your email address?

1 Like

This is an easy way to keep user IDs unique.
As always with Frappe/ERPNext you are in control. You can modify the system to meet your needs.

You can use Third party authentication including LDAP/Active Directory.
You can change the setting (Allow Login using User Name).

Thanks @volkswagner;

I am aware of the option there, but behind the scenes it’s still the email that’s being used to uniquely identify a user, despite that option being checked.

I had a similar situation.

Renaming a User with about 3000+ records (out of total 50K records of a particular child doctype) would take 5+ minutes and if during server’s peak hours, it will always timeout. I had to wait till the load is low to manage to change a user email.

Thankfully we don’t change emails often

1 Like

Hi:

Check this … maybe is happening …

3 Likes

It’s a bummer we can’t “bump” the FR, but oh well. :slight_smile: