← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1464403] Re: Update project/domain members doesn't work on user id that has underscores

 

Reviewed:  https://review.openstack.org/192456
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=0b0d4f764f2138e69a0e88a17dc73243f85aa226
Submitter: Jenkins
Branch:    master

commit 0b0d4f764f2138e69a0e88a17dc73243f85aa226
Author: Jingjing Ren <jingjing_ren@xxxxxxxxxxxx>
Date:   Fri Jun 12 20:13:57 2015 +0000

    Fix issues with updating project/domain members
    
    Update project/domain members in Identity panel does not
    work if the member user id has underscores in it. This change
    fixes the issue by providing a more generic JavaScript function.
    
    Change-Id: Ied1fd65e2ed8e90def68125db9fc1061af26cccb
    Closes-Bug: #1464403


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1464403

Title:
  Update project/domain members doesn't work on user id that has
  underscores

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  The following JavaScript code that used to get the user id grabs the
  part after the last underscore of id_string

  horizon/static/horizon/js/horizon.membership.js

  get_field_id: function(id_string) {
      return id_string.slice(id_string.lastIndexOf("_") + 1);
    },

  If the user id has underscores in it, the returned value will be
  incorrect. For example, if user id is aa_bb, and id_string is
  id_update_members_aa_bb, it will return bb instead of aa_bb.

  This would cause updating members to fail because the returned id is
  invalid.

  
  Steps to reproduce starting with a devstack installation from the current Horizon master code as of 2016-09-06:
  - Log into Horizon as admin
  - Create a new user, and make the demo project the user's default project. Note that the user now has a UUID for an ID.
  - In Horizon, give the new user the admin role on the demo project. Note that this worked.
  - Remove all roles for the new user (probably only admin and Member on the demo project at this point). Log out of Horizon.
  - Start a mysql session on the Host that holds your keystone database.
  - At the mysql prompt, run these commands:
    - use keystone;
    - select * from local_user;
      - Note the user_id of the new user
    - set foreign_key_checks = 0;
    - update user set id = 'new_user' where id = '[UUID of new user]';
    - update local_user set user_id = 'new_user' where user_id = '[UUID of new user]';
    - set foreign_key_checks = 1;
    - select * from local_user;
      - Note that the user_id for the new user is now 'new_user', rather than the previous UUID it had (and it now has an underscore in the ID).
  - Log into Horizon as admin
  - Try to give the Member role to the demo project for the new user.
  - Note that Horizon allows this, shows a success message, and no errors are written to the logs. But the new user doesn't have access after the operation completes.

  
  In situations where all user IDs have underscores in them, managing roles fails for all of them. This can be the case when the users are in LDAP and an LDAP administrator has chosen to use user IDs with underscores.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1464403/+subscriptions


References