コード例 #1
0
 bool run(OperationContext* opCtx,
          const string& dbname,
          const BSONObj& cmdObj,
          BSONObjBuilder& result) {
     AuthorizationSession* authSession = AuthorizationSession::get(Client::getCurrent());
     authSession->logoutDatabase(dbname);
     if (Command::testCommandsEnabled && dbname == "admin") {
         // Allows logging out as the internal user against the admin database, however
         // this actually logs out of the local database as well. This is to
         // support the auth passthrough test framework on mongos (since you can't use the
         // local database on a mongos, so you can't logout as the internal user
         // without this).
         authSession->logoutDatabase("local");
     }
     return true;
 }
コード例 #2
0
 bool run(const string& dbname,
          BSONObj& cmdObj,
          int options,
          string& errmsg,
          BSONObjBuilder& result,
          bool fromRepl) {
     AuthorizationSession* authSession =
             ClientBasic::getCurrent()->getAuthorizationSession();
     authSession->logoutDatabase(dbname);
     return true;
 }