renameCollection should only require auth on source and dest DBs, not admin SERVER-1061

Still technically an admin command and requires running against admin db
This commit is contained in:
Mathias Stearn
2011-05-25 15:55:20 -04:00
parent 6bfc2d5d5f
commit 52d7736f73
2 changed files with 42 additions and 2 deletions

View File

@@ -613,6 +613,7 @@ namespace mongo {
virtual bool adminOnly() const {
return true;
}
virtual bool requiresAuth() { return false; } // do our own auth
virtual bool slaveOk() const {
return false;
}
@@ -634,7 +635,7 @@ namespace mongo {
bool capped = false;
long long size = 0;
{
Client::Context ctx( source );
Client::Context ctx( source ); // auths against source
NamespaceDetails *nsd = nsdetails( source.c_str() );
uassert( 10026 , "source namespace does not exist", nsd );
capped = nsd->capped;
@@ -643,7 +644,7 @@ namespace mongo {
size += i.ext()->length;
}
Client::Context ctx( target );
Client::Context ctx( target ); //auths against target
if ( nsdetails( target.c_str() ) ) {
uassert( 10027 , "target namespace exists", cmdObj["dropTarget"].trueValue() );