summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-08-21 19:15:13 -0400
committerSpencer T Brody <spencer@10gen.com>2013-08-26 11:49:00 -0400
commit4693cd6124b50bc73208c7dc81b498ff435c14b6 (patch)
tree1b5e4742a07a07141ce9803deda06ba97aa5e306 /src
parent33bd62f684db326aca3c4246a2cd8ed6595bae0b (diff)
downloadmongo-4693cd6124b50bc73208c7dc81b498ff435c14b6.tar.gz
SERVER-9517 Remove dbname argument from AuthzManager::hasPrivilegeDocument
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/auth/authorization_manager.cpp4
-rw-r--r--src/mongo/db/auth/authorization_manager.h4
-rw-r--r--src/mongo/db/auth/authz_manager_external_state.cpp4
-rw-r--r--src/mongo/db/auth/authz_manager_external_state.h4
-rw-r--r--src/mongo/db/auth/authz_session_external_state_server_common.cpp2
-rw-r--r--src/mongo/db/restapi.cpp2
6 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp
index e0e092b1fb1..7fbb835f88f 100644
--- a/src/mongo/db/auth/authorization_manager.cpp
+++ b/src/mongo/db/auth/authorization_manager.cpp
@@ -103,8 +103,8 @@ namespace mongo {
return _externalState->getPrivilegeDocument(dbname, userName, result);
}
- bool AuthorizationManager::hasPrivilegeDocument(const std::string& dbname) const {
- return _externalState->hasPrivilegeDocument(dbname);
+ bool AuthorizationManager::hasAnyPrivilegeDocuments() const {
+ return _externalState->hasAnyPrivilegeDocuments();
}
Status AuthorizationManager::insertPrivilegeDocument(const std::string& dbname,
diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h
index fa169ca473d..e59b2d10b99 100644
--- a/src/mongo/db/auth/authorization_manager.h
+++ b/src/mongo/db/auth/authorization_manager.h
@@ -94,8 +94,8 @@ namespace mongo {
const UserName& userName,
BSONObj* result) const;
- // Returns true if there exists at least one privilege document in the given database.
- bool hasPrivilegeDocument(const std::string& dbname) const;
+ // Returns true if there exists at least one privilege document in the system.
+ bool hasAnyPrivilegeDocuments() const;
// Creates the given user object in the given database.
Status insertPrivilegeDocument(const std::string& dbname, const BSONObj& userObj) const;
diff --git a/src/mongo/db/auth/authz_manager_external_state.cpp b/src/mongo/db/auth/authz_manager_external_state.cpp
index 402405f6cec..516d08f3195 100644
--- a/src/mongo/db/auth/authz_manager_external_state.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state.cpp
@@ -78,8 +78,8 @@ namespace mongo {
return Status::OK();
}
- bool AuthzManagerExternalState::hasPrivilegeDocument(const std::string& dbname) const {
- std::string usersNamespace = dbname + ".system.users";
+ bool AuthzManagerExternalState::hasAnyPrivilegeDocuments() const {
+ std::string usersNamespace = "admin.system.users";
BSONObj userBSONObj;
BSONObj query;
diff --git a/src/mongo/db/auth/authz_manager_external_state.h b/src/mongo/db/auth/authz_manager_external_state.h
index 72abb3e5190..b27f70dc7a3 100644
--- a/src/mongo/db/auth/authz_manager_external_state.h
+++ b/src/mongo/db/auth/authz_manager_external_state.h
@@ -47,8 +47,8 @@ namespace mongo {
BSONObj* result) const;
- // Returns true if there exists at least one privilege document in the given database.
- bool hasPrivilegeDocument(const std::string& dbname) const;
+ // Returns true if there exists at least one privilege document in the system.
+ bool hasAnyPrivilegeDocuments() const;
// Creates the given user object in the given database.
virtual Status insertPrivilegeDocument(const std::string& dbname,
diff --git a/src/mongo/db/auth/authz_session_external_state_server_common.cpp b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
index 11a01690eab..33facc5d23d 100644
--- a/src/mongo/db/auth/authz_session_external_state_server_common.cpp
+++ b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
@@ -49,7 +49,7 @@ namespace {
return;
}
- _allowLocalhost = !_authzManager->hasPrivilegeDocument("admin");
+ _allowLocalhost = !_authzManager->hasAnyPrivilegeDocuments();
if (_allowLocalhost) {
ONCE {
log() << "note: no users configured in admin.system.users, allowing localhost "
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index 57262b73a7b..1c6534bee9f 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -250,7 +250,7 @@ namespace mongo {
bool RestAdminAccess::haveAdminUsers() const {
AuthorizationSession* authzSession = cc().getAuthorizationSession();
- return authzSession->getAuthorizationManager().hasPrivilegeDocument("admin");
+ return authzSession->getAuthorizationManager().hasAnyPrivilegeDocuments();
}
BSONObj RestAdminAccess::getAdminUser(const UserName& username) const {