Fix users page display error

According bug description, the users page show error
with host and dbs.  The cause of the problem is we can
not only use user_name as id, it is not unique. Now I
changed the id as the combination of user_name and
user_host.

Change-Id: I28136de2b7c79633dd51bdea5d704038c29aa516
Closes-Bug: #1737695
This commit is contained in:
wangyao 2017-12-13 16:28:27 +08:00
parent cfbfa59c7f
commit ac30be57ae
2 changed files with 3 additions and 2 deletions

View File

@ -692,7 +692,8 @@ class UsersTable(tables.DataTable):
row_actions = [EditUser, ManageAccess, DeleteUser]
def get_object_id(self, datum):
return datum.name
obj_id = datum.name + "@" + datum.host
return obj_id
class DatabaseTable(tables.DataTable):

View File

@ -635,7 +635,7 @@ class DatabaseTests(test.TestCase):
database_id = database.id
# Instead of using the user's ID, the api uses the user's name. BOOO!
user_id = user.name
user_id = user.name + "@" + user.host
# views.py: DetailView.get_data
api.trove.instance_get(IsA(http.HttpRequest), IsA(six.text_type))\