diff options
author | Spencer T Brody <spencer@10gen.com> | 2013-10-05 18:08:33 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2013-10-06 12:02:45 -0400 |
commit | 3e5905a8d427539d62d56e4bb72ae55638544a99 (patch) | |
tree | 107a2e3a9c1659edb105e255cfd79a9ddb4cac79 /src/mongo/db/auth/user_document_parser.cpp | |
parent | 31d759f0fc3ac453b5297df2012fce9c1118ce6f (diff) | |
download | mongo-3e5905a8d427539d62d56e4bb72ae55638544a99.tar.gz |
SERVER-9517 Rename "source" field for users and roles to "db"
Diffstat (limited to 'src/mongo/db/auth/user_document_parser.cpp')
-rw-r--r-- | src/mongo/db/auth/user_document_parser.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/db/auth/user_document_parser.cpp b/src/mongo/db/auth/user_document_parser.cpp index 77b0cdb9452..3ba3e19e06c 100644 --- a/src/mongo/db/auth/user_document_parser.cpp +++ b/src/mongo/db/auth/user_document_parser.cpp @@ -48,7 +48,7 @@ namespace { const std::string READONLY_FIELD_NAME = "readOnly"; const std::string CREDENTIALS_FIELD_NAME = "credentials"; const std::string ROLE_NAME_FIELD_NAME = "name"; - const std::string ROLE_SOURCE_FIELD_NAME = "source"; + const std::string ROLE_SOURCE_FIELD_NAME = "db"; const std::string ROLE_CAN_DELEGATE_FIELD_NAME = "canDelegate"; const std::string ROLE_HAS_ROLE_FIELD_NAME = "hasRole"; const std::string MONGODB_CR_CREDENTIAL_FIELD_NAME = "MONGODB-CR"; @@ -242,19 +242,18 @@ namespace { // Validate the "userSource" element if (userSourceElement.type() != String || makeStringDataFromBSONElement(userSourceElement).empty()) { - return _badValue("User document needs 'userSource' field to be a non-empty string", 0); + return _badValue("User document needs 'db' field to be a non-empty string", 0); } StringData userSourceStr = makeStringDataFromBSONElement(userSourceElement); if (!NamespaceString::validDBName(userSourceStr) && userSourceStr != "$external") { return _badValue(mongoutils::str::stream() << "'" << userSourceStr << - "' is not a valid value for the userSource field.", + "' is not a valid value for the db field.", 0); } // Validate the "credentials" element if (credentialsElement.eoo() && userSourceStr != "$external") { - return _badValue("User document needs 'credentials' field unless userSource is " - "'$external'", + return _badValue("User document needs 'credentials' field unless 'db' is '$external'", 0); } if (!credentialsElement.eoo()) { @@ -320,7 +319,7 @@ namespace { } else { return Status(ErrorCodes::UnsupportedFormat, "Cannot extract credentials from user documents without a " - "'credentials' field and with userSource != \"$external\""); + "'credentials' field and with 'db' != \"$external\""); } user->setCredentials(credentials); @@ -347,8 +346,7 @@ namespace { } if (roleSourceElement->type() != String || makeStringDataFromBSONElement(*roleSourceElement).empty()) { - return Status(ErrorCodes::UnsupportedFormat, - "Role source must be non-empty strings"); + return Status(ErrorCodes::UnsupportedFormat, "Role db must be non-empty strings"); } if (hasPossessionBools) { if (canDelegateElement->type() != Bool) { |