diff options
author | Eliot Horowitz <eliot@10gen.com> | 2013-06-25 19:42:11 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2013-06-26 22:36:37 -0400 |
commit | 692f1859a032a92e54f08b1a2a130fa99590b1d0 (patch) | |
tree | cb5704667f7ec4254b3a837e2f2668cfbaacafe5 /src/mongo/db/auth/authorization_session.cpp | |
parent | bd0713e9a67f67b19944841275007f6fc6ee1c69 (diff) | |
download | mongo-692f1859a032a92e54f08b1a2a130fa99590b1d0.tar.gz |
clean NamespaceString so that it can be the thing passed around
Diffstat (limited to 'src/mongo/db/auth/authorization_session.cpp')
-rw-r--r-- | src/mongo/db/auth/authorization_session.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/auth/authorization_session.cpp b/src/mongo/db/auth/authorization_session.cpp index 2fbbcbd1bf3..24f28251f27 100644 --- a/src/mongo/db/auth/authorization_session.cpp +++ b/src/mongo/db/auth/authorization_session.cpp @@ -234,17 +234,18 @@ namespace { Privilege AuthorizationSession::_modifyPrivilegeForSpecialCases(const Privilege& privilege) { ActionSet newActions; newActions.addAllActionsFromSet(privilege.getActions()); - std::string collectionName = NamespaceString(privilege.getResource()).coll; - if (collectionName == "system.users") { + NamespaceString ns( privilege.getResource() ); + + if (ns.coll() == "system.users") { newActions.removeAction(ActionType::find); newActions.removeAction(ActionType::insert); newActions.removeAction(ActionType::update); newActions.removeAction(ActionType::remove); newActions.addAction(ActionType::userAdmin); - } else if (collectionName == "system.profile") { + } else if (ns.coll() == "system.profile") { newActions.removeAction(ActionType::find); newActions.addAction(ActionType::profileRead); - } else if (collectionName == "system.indexes" && newActions.contains(ActionType::find)) { + } else if (ns.coll() == "system.indexes" && newActions.contains(ActionType::find)) { newActions.removeAction(ActionType::find); newActions.addAction(ActionType::indexRead); } |