summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmalia Hawkins <amalia.hawkins@10gen.com>2014-07-22 11:22:34 -0400
committerAmalia Hawkins <amalia.hawkins@10gen.com>2014-07-22 11:31:06 -0400
commit6c9e9a907352ca91a72c2818637506e9f7a42421 (patch)
tree06f590322dcdb353bf32d49df316f67025ad50c5
parent9c4d4cd84a82ba7ca782b69e0bdc821e8c3ff997 (diff)
downloadmongo-6c9e9a907352ca91a72c2818637506e9f7a42421.tar.gz
SERVER-14650 Rename ROLE_SOURCE_FIELD_NAME to ROLE_DB_FIELD_NAME
-rw-r--r--src/mongo/db/auth/auth_index_d.cpp4
-rw-r--r--src/mongo/db/auth/authorization_manager.cpp10
-rw-r--r--src/mongo/db/auth/authorization_manager.h2
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_local.cpp4
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_mock.cpp2
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_s.cpp2
-rw-r--r--src/mongo/db/auth/role_graph_update.cpp2
-rw-r--r--src/mongo/db/auth/user_document_parser.cpp4
-rw-r--r--src/mongo/db/auth/user_management_commands_parser.cpp4
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp32
10 files changed, 33 insertions, 33 deletions
diff --git a/src/mongo/db/auth/auth_index_d.cpp b/src/mongo/db/auth/auth_index_d.cpp
index 694530f535b..b614e8e1602 100644
--- a/src/mongo/db/auth/auth_index_d.cpp
+++ b/src/mongo/db/auth/auth_index_d.cpp
@@ -57,7 +57,7 @@ namespace {
v3SystemUsersKeyPattern = BSON(AuthorizationManager::USER_NAME_FIELD_NAME << 1 <<
AuthorizationManager::USER_DB_FIELD_NAME << 1);
v3SystemRolesKeyPattern = BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << 1 <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << 1);
+ AuthorizationManager::ROLE_DB_FIELD_NAME << 1);
v3SystemUsersIndexName = std::string(
str::stream() <<
AuthorizationManager::USER_NAME_FIELD_NAME << "_1_" <<
@@ -65,7 +65,7 @@ namespace {
v3SystemRolesIndexName = std::string(
str::stream() <<
AuthorizationManager::ROLE_NAME_FIELD_NAME << "_1_" <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << "_1");
+ AuthorizationManager::ROLE_DB_FIELD_NAME << "_1");
return Status::OK();
}
diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp
index 09326ade31a..c507b721cf5 100644
--- a/src/mongo/db/auth/authorization_manager.cpp
+++ b/src/mongo/db/auth/authorization_manager.cpp
@@ -81,7 +81,7 @@ namespace mongo {
const std::string AuthorizationManager::USER_NAME_FIELD_NAME = "user";
const std::string AuthorizationManager::USER_DB_FIELD_NAME = "db";
const std::string AuthorizationManager::ROLE_NAME_FIELD_NAME = "role";
- const std::string AuthorizationManager::ROLE_SOURCE_FIELD_NAME = "db";
+ const std::string AuthorizationManager::ROLE_DB_FIELD_NAME = "db";
const std::string AuthorizationManager::PASSWORD_FIELD_NAME = "pwd";
const std::string AuthorizationManager::V1_USER_NAME_FIELD_NAME = "user";
const std::string AuthorizationManager::V1_USER_SOURCE_FIELD_NAME = "userSource";
@@ -354,7 +354,7 @@ namespace mongo {
}
if (status.code() == ErrorCodes::DuplicateKey) {
std::string name = roleObj[AuthorizationManager::ROLE_NAME_FIELD_NAME].String();
- std::string source = roleObj[AuthorizationManager::ROLE_SOURCE_FIELD_NAME].String();
+ std::string source = roleObj[AuthorizationManager::ROLE_DB_FIELD_NAME].String();
return Status(ErrorCodes::DuplicateKey,
mongoutils::str::stream() << "Role \"" << name << "@" << source <<
"\" already exists");
@@ -371,7 +371,7 @@ namespace mongo {
Status status = _externalState->updateOne(
rolesCollectionNamespace,
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << role.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << role.getDB()),
+ AuthorizationManager::ROLE_DB_FIELD_NAME << role.getDB()),
updateObj,
false,
writeConcern);
@@ -438,7 +438,7 @@ namespace mongo {
std::string id = mongoutils::str::stream() << roleName.getDB() << "." << roleName.getRole();
result.appendString("_id", id);
result.appendString(ROLE_NAME_FIELD_NAME, roleName.getRole());
- result.appendString(ROLE_SOURCE_FIELD_NAME, roleName.getDB());
+ result.appendString(ROLE_DB_FIELD_NAME, roleName.getDB());
// Build privileges array
mutablebson::Element privilegesArrayElement =
@@ -460,7 +460,7 @@ namespace mongo {
const RoleName& subRole = roles.get();
mutablebson::Element roleObj = result.getDocument().makeElementObject("");
roleObj.appendString(ROLE_NAME_FIELD_NAME, subRole.getRole());
- roleObj.appendString(ROLE_SOURCE_FIELD_NAME, subRole.getDB());
+ roleObj.appendString(ROLE_DB_FIELD_NAME, subRole.getDB());
rolesArrayElement.pushBack(roleObj);
}
diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h
index c03e5b3eb66..b8f1fb714ae 100644
--- a/src/mongo/db/auth/authorization_manager.h
+++ b/src/mongo/db/auth/authorization_manager.h
@@ -78,7 +78,7 @@ namespace mongo {
static const std::string USER_NAME_FIELD_NAME;
static const std::string USER_DB_FIELD_NAME;
static const std::string ROLE_NAME_FIELD_NAME;
- static const std::string ROLE_SOURCE_FIELD_NAME; // TODO: rename to ROLE_DB_FIELD_NAME
+ static const std::string ROLE_DB_FIELD_NAME;
static const std::string PASSWORD_FIELD_NAME;
static const std::string V1_USER_NAME_FIELD_NAME;
static const std::string V1_USER_SOURCE_FIELD_NAME;
diff --git a/src/mongo/db/auth/authz_manager_external_state_local.cpp b/src/mongo/db/auth/authz_manager_external_state_local.cpp
index 926158bc740..c078ba5d7bc 100644
--- a/src/mongo/db/auth/authz_manager_external_state_local.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_local.cpp
@@ -104,7 +104,7 @@ namespace {
void addRoleNameToObjectElement(mutablebson::Element object, const RoleName& role) {
fassert(17153, object.appendString(AuthorizationManager::ROLE_NAME_FIELD_NAME,
role.getRole()));
- fassert(17154, object.appendString(AuthorizationManager::ROLE_SOURCE_FIELD_NAME,
+ fassert(17154, object.appendString(AuthorizationManager::ROLE_DB_FIELD_NAME,
role.getDB()));
}
@@ -226,7 +226,7 @@ namespace {
fassert(17162, resultDoc.root().appendString(
AuthorizationManager::ROLE_NAME_FIELD_NAME, roleName.getRole()));
fassert(17163, resultDoc.root().appendString(
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME, roleName.getDB()));
+ AuthorizationManager::ROLE_DB_FIELD_NAME, roleName.getDB()));
fassert(17267,
resultDoc.root().appendBool("isBuiltin", _roleGraph.isBuiltinRole(roleName)));
mutablebson::Element rolesElement = resultDoc.makeElementArray("roles");
diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.cpp b/src/mongo/db/auth/authz_manager_external_state_mock.cpp
index 95bf9f5b1c7..c11ab6e7471 100644
--- a/src/mongo/db/auth/authz_manager_external_state_mock.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_mock.cpp
@@ -47,7 +47,7 @@ namespace mongo {
namespace {
void addRoleNameToObjectElement(mutablebson::Element object, const RoleName& role) {
fassert(17175, object.appendString(AuthorizationManager::ROLE_NAME_FIELD_NAME, role.getRole()));
- fassert(17176, object.appendString(AuthorizationManager::ROLE_SOURCE_FIELD_NAME, role.getDB()));
+ fassert(17176, object.appendString(AuthorizationManager::ROLE_DB_FIELD_NAME, role.getDB()));
}
void addRoleNameObjectsToArrayElement(mutablebson::Element array, RoleNameIterator roles) {
diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp
index bf5430a0b8b..7449f1975d7 100644
--- a/src/mongo/db/auth/authz_manager_external_state_s.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp
@@ -132,7 +132,7 @@ namespace mongo {
BSON("rolesInfo" <<
BSON_ARRAY(BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME <<
roleName.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ AuthorizationManager::ROLE_DB_FIELD_NAME <<
roleName.getDB())) <<
"showPrivileges" << showPrivileges),
cmdResult);
diff --git a/src/mongo/db/auth/role_graph_update.cpp b/src/mongo/db/auth/role_graph_update.cpp
index 7f29588a0d3..6236bcc50ae 100644
--- a/src/mongo/db/auth/role_graph_update.cpp
+++ b/src/mongo/db/auth/role_graph_update.cpp
@@ -60,7 +60,7 @@ namespace {
if (!status.isOK())
return status;
status = bsonExtractTypedField(
- doc, AuthorizationManager::ROLE_SOURCE_FIELD_NAME, String, &sourceElement);
+ doc, AuthorizationManager::ROLE_DB_FIELD_NAME, String, &sourceElement);
if (!status.isOK())
return status;
*name = RoleName(nameElement.valueStringData(), sourceElement.valueStringData());
diff --git a/src/mongo/db/auth/user_document_parser.cpp b/src/mongo/db/auth/user_document_parser.cpp
index 4e78a712710..39ee04be0d4 100644
--- a/src/mongo/db/auth/user_document_parser.cpp
+++ b/src/mongo/db/auth/user_document_parser.cpp
@@ -50,7 +50,7 @@ namespace {
const std::string READONLY_FIELD_NAME = "readOnly";
const std::string CREDENTIALS_FIELD_NAME = "credentials";
const std::string ROLE_NAME_FIELD_NAME = "role";
- const std::string ROLE_SOURCE_FIELD_NAME = "db";
+ const std::string ROLE_DB_FIELD_NAME = "db";
const std::string MONGODB_CR_CREDENTIAL_FIELD_NAME = "MONGODB-CR";
const std::string SCRAM_CREDENTIAL_FIELD_NAME = "SCRAM-SHA-1";
const std::string MONGODB_EXTERNAL_CREDENTIAL_FIELD_NAME = "external";
@@ -397,7 +397,7 @@ namespace {
BSONElement* roleSourceElement) {
*roleNameElement = roleObject[ROLE_NAME_FIELD_NAME];
- *roleSourceElement = roleObject[ROLE_SOURCE_FIELD_NAME];
+ *roleSourceElement = roleObject[ROLE_DB_FIELD_NAME];
if (roleNameElement->type() != String || roleNameElement->valueStringData().empty()) {
return Status(ErrorCodes::UnsupportedFormat,
diff --git a/src/mongo/db/auth/user_management_commands_parser.cpp b/src/mongo/db/auth/user_management_commands_parser.cpp
index bd6ec6d025d..035c39985ec 100644
--- a/src/mongo/db/auth/user_management_commands_parser.cpp
+++ b/src/mongo/db/auth/user_management_commands_parser.cpp
@@ -154,7 +154,7 @@ namespace auth {
return _parseNamesFromBSONArray(rolesArray,
dbname,
AuthorizationManager::ROLE_NAME_FIELD_NAME,
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME,
+ AuthorizationManager::ROLE_DB_FIELD_NAME,
parsedRoleNames);
}
@@ -434,7 +434,7 @@ namespace auth {
status = _parseNameFromBSONElement(cmdObj["rolesInfo"],
dbname,
AuthorizationManager::ROLE_NAME_FIELD_NAME,
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME,
+ AuthorizationManager::ROLE_DB_FIELD_NAME,
&name);
if (!status.isOK()) {
return status;
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index b35abc89b1c..2526bf3e135 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -81,7 +81,7 @@ namespace mongo {
const RoleName& role = *it;
rolesArrayBuilder.append(
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << role.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << role.getDB()));
+ AuthorizationManager::ROLE_DB_FIELD_NAME << role.getDB()));
}
return rolesArrayBuilder.arr();
}
@@ -92,7 +92,7 @@ namespace mongo {
const RoleName& role = *it;
rolesArrayBuilder.append(
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << role.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << role.getDB()));
+ AuthorizationManager::ROLE_DB_FIELD_NAME << role.getDB()));
}
return rolesArrayBuilder.arr();
}
@@ -1264,7 +1264,7 @@ namespace mongo {
args.roleName.getRole());
roleObjBuilder.append(AuthorizationManager::ROLE_NAME_FIELD_NAME,
args.roleName.getRole());
- roleObjBuilder.append(AuthorizationManager::ROLE_SOURCE_FIELD_NAME,
+ roleObjBuilder.append(AuthorizationManager::ROLE_DB_FIELD_NAME,
args.roleName.getDB());
BSONArray privileges;
@@ -2038,12 +2038,12 @@ namespace mongo {
BSON("roles" << BSON("$elemMatch" <<
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME <<
roleName.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ AuthorizationManager::ROLE_DB_FIELD_NAME <<
roleName.getDB()))),
BSON("$pull" << BSON("roles" <<
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME <<
roleName.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ AuthorizationManager::ROLE_DB_FIELD_NAME <<
roleName.getDB()))),
false,
true,
@@ -2067,12 +2067,12 @@ namespace mongo {
BSON("roles" << BSON("$elemMatch" <<
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME <<
roleName.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ AuthorizationManager::ROLE_DB_FIELD_NAME <<
roleName.getDB()))),
BSON("$pull" << BSON("roles" <<
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME <<
roleName.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ AuthorizationManager::ROLE_DB_FIELD_NAME <<
roleName.getDB()))),
false,
true,
@@ -2096,7 +2096,7 @@ namespace mongo {
// Finally, remove the actual role document
status = authzManager->removeRoleDocuments(
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << roleName.getRole() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << roleName.getDB()),
+ AuthorizationManager::ROLE_DB_FIELD_NAME << roleName.getDB()),
writeConcern,
&nMatched);
// Must invalidate even on bad status - what if the write succeeded but the GLE failed?
@@ -2187,9 +2187,9 @@ namespace mongo {
int nMatched;
status = authzManager->updateAuthzDocuments(
AuthorizationManager::usersCollectionNamespace,
- BSON("roles" << BSON(AuthorizationManager::ROLE_SOURCE_FIELD_NAME << dbname)),
+ BSON("roles" << BSON(AuthorizationManager::ROLE_DB_FIELD_NAME << dbname)),
BSON("$pull" << BSON("roles" <<
- BSON(AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ BSON(AuthorizationManager::ROLE_DB_FIELD_NAME <<
dbname))),
false,
true,
@@ -2209,12 +2209,12 @@ namespace mongo {
// Remove these roles from all other roles
std::string sourceFieldName =
- str::stream() << "roles." << AuthorizationManager::ROLE_SOURCE_FIELD_NAME;
+ str::stream() << "roles." << AuthorizationManager::ROLE_DB_FIELD_NAME;
status = authzManager->updateAuthzDocuments(
AuthorizationManager::rolesCollectionNamespace,
BSON(sourceFieldName << dbname),
BSON("$pull" << BSON("roles" <<
- BSON(AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ BSON(AuthorizationManager::ROLE_DB_FIELD_NAME <<
dbname))),
false,
true,
@@ -2235,7 +2235,7 @@ namespace mongo {
audit::logDropAllRolesFromDatabase(ClientBasic::getCurrent(), dbname);
// Finally, remove the actual role documents
status = authzManager->removeRoleDocuments(
- BSON(AuthorizationManager::ROLE_SOURCE_FIELD_NAME << dbname),
+ BSON(AuthorizationManager::ROLE_DB_FIELD_NAME << dbname),
writeConcern,
&nMatched);
// Must invalidate even on bad status - what if the write succeeded but the GLE failed?
@@ -2559,7 +2559,7 @@ namespace mongo {
&name);
uassertStatusOK(status);
status = bsonExtractStringField(roleObj,
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME,
+ AuthorizationManager::ROLE_DB_FIELD_NAME,
&db);
uassertStatusOK(status);
return RoleName(name, db);
@@ -2810,7 +2810,7 @@ namespace mongo {
BSONObj query = db.empty() ?
BSONObj() : BSON(AuthorizationManager::ROLE_SOURCE_FIELD_NAME << db);
BSONObj fields = BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << 1 <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME << 1);
+ AuthorizationManager::ROLE_DB_FIELD_NAME << 1);
Status status = authzManager->queryAuthzDocument(
AuthorizationManager::rolesCollectionNamespace,
@@ -2849,7 +2849,7 @@ namespace mongo {
status = authzManager->removeRoleDocuments(
BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME <<
roleName.getRole().toString() <<
- AuthorizationManager::ROLE_SOURCE_FIELD_NAME <<
+ AuthorizationManager::ROLE_DB_FIELD_NAME <<
roleName.getDB().toString()
),
writeConcern,