apigee / apigee-edge-drupal

The Apigee Edge module enables you to integrate a Drupal 9 or 8 site with Apigee.
https://www.drupal.org/project/apigee_edge
GNU General Public License v2.0
32 stars 45 forks source link

Stop changing username to "Firstname Lastname" #280

Closed cnovak closed 4 years ago

cnovak commented 5 years ago

Description

Issue https://github.com/apigee/apigee-devportal-kickstart-drupal/issues/270 explains how changing the username to display user's firstname and lastname has unintended consequences. Instead of fixing this in Kickstart with https://github.com/apigee/apigee-devportal-kickstart-drupal/pull/274, we should properly fix this in this base module.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new user with First Name "Test", Last Name "User", Email test@example.com".
  2. View the user's profile page, the username will be user-view

This will also happen on the user listing page in the admin screens.

Expected behavior

Username should display the user's username.

Version Info

Apigee Edge 8.x-1.1 and below

minnur commented 5 years ago

@cnovak I created a new PR for the Apigee Edge and modified Kickstarter PR created by Arshad (we needed that one to display Full name and usernames on profile pages).

  1. https://github.com/apigee/apigee-edge-drupal/pull/281
  2. https://github.com/apigee/apigee-devportal-kickstart-drupal/pull/274

I also asked Arlina to review those PRs.

Thanks,

Minnur

mxr576 commented 5 years ago

Okay, so if I understand it correctly from all references issues, you also did something in Kickstarter which:

The current release 1.5.0 hides the username from the system, and must autogenerate it in the background.

Consequently, when a user registers in a kickstart installation then it does not set its username and when it would need to know its username then it cannot find it on the site because:

This makes it very hard to use the Expose REST APIs to interact with API Docs instructions since the basic_auth module uses the username to authenticate. The username is hidden in the edit user form and shown in the view user profile incorrectly (displays First Name Last Name)

Neither an admin cannot tell that to a user because on the admin/people page even an admin cannot see it?

https://github.com/apigee/apigee-devportal-kickstart-drupal/issues/270#issuecomment-540690858

Now I understand why this username apigee_edge_user_format_name_alter() implementation is a problem in a Kickstarter installation. It is not a problem on regular installations when only the Apigee Edge module is installed, because the username is always visible on the registration form and it could be visible on the user view page.

Based on this, #281 is just a workaround to the problem, but it does not solve the real one.

I see two possible options to fix the real issue that you have:

  1. (Kickstart only) In a hook_module_implement_alter() implementation in the Kickstarter, remove the apigee_edge_user_format_name_alter() from the implementations, so it won't change the usernames.
  2. (A more generic solution) Make it configurable whether the username gets replaces with first name+last name or not in the module. (I would prefer this option)

Let me know if I misunderstood something.

cnovak commented 4 years ago

Closing as duplicate of #307 to reduce confusion