@@ -79,8 +79,14 @@ namespace {
7979 AuthorizationManager::usersCollectionNamespace));
8080 BSONObj cmdResult;
8181 conn->get ()->runCommand (
82- userName.getDB ().toString (), // TODO: Change usersInfo so this command can always go to "admin".
83- BSON (" usersInfo" << userName.getUser () << " details" << true ),
82+ " admin" ,
83+ BSON (" usersInfo" <<
84+ BSON_ARRAY (BSON (AuthorizationManager::USER_NAME_FIELD_NAME <<
85+ userName.getUser () <<
86+ AuthorizationManager::USER_SOURCE_FIELD_NAME <<
87+ userName.getDB ())) <<
88+ " showPrivileges" << true <<
89+ " showCredentials" << true ),
8490 cmdResult);
8591 if (!cmdResult[" ok" ].trueValue ()) {
8692 int code = cmdResult[" code" ].numberInt ();
@@ -102,8 +108,12 @@ namespace {
102108 AuthorizationManager::rolesCollectionNamespace));
103109 BSONObj cmdResult;
104110 conn->get ()->runCommand (
105- roleName.getDB ().toString (), // TODO: Change rolesInfo so this command can always go to "admin".
106- BSON (" rolesInfo" << roleName.getRole ()),
111+ " admin" ,
112+ BSON (" rolesInfo" <<
113+ BSON_ARRAY (BSON (AuthorizationManager::ROLE_NAME_FIELD_NAME <<
114+ roleName.getRole () <<
115+ AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
116+ roleName.getDB ()))),
107117 cmdResult);
108118 if (!cmdResult[" ok" ].trueValue ()) {
109119 int code = cmdResult[" code" ].numberInt ();
@@ -138,10 +148,11 @@ namespace {
138148 Status AuthzManagerExternalStateMongos::query (
139149 const NamespaceString& collectionName,
140150 const BSONObj& query,
151+ const BSONObj& projection,
141152 const boost::function<void (const BSONObj&)>& resultProcessor) {
142153 try {
143154 scoped_ptr<ScopedDbConnection> conn (getConnectionForAuthzCollection (collectionName));
144- conn->get ()->query (resultProcessor, collectionName.ns (), query);
155+ conn->get ()->query (resultProcessor, collectionName.ns (), query, &projection );
145156 return Status::OK ();
146157 } catch (const DBException& e) {
147158 return e.toStatus ();
0 commit comments