-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Dev Exp
-
None
-
3
The users.info method is documented to return a hash of information for a particular user, but it actually returns an array of hashes:
(byebug) root_authorized_client.use('admin').database.users.info('dev') [{"_id"=>"admin.dev", "user"=>"dev", "db"=>"admin", "roles"=>[{"role"=>"dbAdminAnyDatabase", "db"=>"admin"}, {"role"=>"readWriteAnyDatabase", "db"=>"admin"}, {"role"=>"userAdminAnyDatabase", "db"=>"admin"}, {"role"=>"clusterAdmin", "db"=>"admin"}], "mechanisms"=>["SCRAM-SHA-1"]}]
Furthermore, https://docs.mongodb.com/manual/reference/command/usersInfo/ documents that a list of user names may be given as an argument. Ruby driver accepts an array of user names as an argument to `info` but returns information for only one of them, and which user is picked seems deterministic but is totally unclear:
(byebug) root_authorized_client.use('admin').database.users.info(['foo']) [{"_id"=>"admin.foo", "user"=>"foo", "db"=>"admin", "roles"=>[{"role"=>"dbAdmin", "db"=>"admin"}], "mechanisms"=>["SCRAM-SHA-1", "SCRAM-SHA-256"]}] (byebug) root_authorized_client.use('admin').database.users.info(['dev','foo']) [{"_id"=>"admin.dev", "user"=>"dev", "db"=>"admin", "roles"=>[{"role"=>"dbAdminAnyDatabase", "db"=>"admin"}, {"role"=>"readWriteAnyDatabase", "db"=>"admin"}, {"role"=>"userAdminAnyDatabase", "db"=>"admin"}, {"role"=>"clusterAdmin", "db"=>"admin"}], "mechanisms"=>["SCRAM-SHA-1"]}, {"_id"=>"admin.foo", "user"=>"foo", "db"=>"admin", "roles"=>[{"role"=>"dbAdmin", "db"=>"admin"}], "mechanisms"=>["SCRAM-SHA-1", "SCRAM-SHA-256"]}] (byebug) root_authorized_client.use('admin').database.users.info(['foo','dev']) [{"_id"=>"admin.dev", "user"=>"dev", "db"=>"admin", "roles"=>[{"role"=>"dbAdminAnyDatabase", "db"=>"admin"}, {"role"=>"readWriteAnyDatabase", "db"=>"admin"}, {"role"=>"userAdminAnyDatabase", "db"=>"admin"}, {"role"=>"clusterAdmin", "db"=>"admin"}], "mechanisms"=>["SCRAM-SHA-1"]}, {"_id"=>"admin.foo", "user"=>"foo", "db"=>"admin", "roles"=>[{"role"=>"dbAdmin", "db"=>"admin"}], "mechanisms"=>["SCRAM-SHA-1", "SCRAM-SHA-256"]}]
Action items:
- The method behavior should match its documentation.
- Investigate whether more of usersInfo functionality can be supported, and how to best expose it.
- duplicates
-
RUBY-1746 Revamp user management documentation
- Closed