summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/role_graph.cpp
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-09-30 18:40:39 -0400
committerSpencer T Brody <spencer@10gen.com>2013-10-04 17:17:51 -0400
commitd09e608691aae000f3176b27cc67a7900229cd1e (patch)
tree8740c59feef65ab28b7b8dc55fc85996a71acaed /src/mongo/db/auth/role_graph.cpp
parente0f70cdb67a36c831a23b452e7b9fba41f512ae0 (diff)
downloadmongo-d09e608691aae000f3176b27cc67a7900229cd1e.tar.gz
SERVER-9515 Implement several remaining role manipulation commands
Diffstat (limited to 'src/mongo/db/auth/role_graph.cpp')
-rw-r--r--src/mongo/db/auth/role_graph.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/db/auth/role_graph.cpp b/src/mongo/db/auth/role_graph.cpp
index d42354aa577..a010326f57c 100644
--- a/src/mongo/db/auth/role_graph.cpp
+++ b/src/mongo/db/auth/role_graph.cpp
@@ -40,6 +40,7 @@ namespace mongo {
namespace {
PrivilegeVector emptyPrivilegeVector;
+ std::vector<RoleName> emptyRoleVector;
// RoleNameIterator for iterating over an unordered_set of RoleNames.
class RoleNameSetIterator : public RoleNameIterator::Impl {
@@ -75,6 +76,7 @@ namespace {
unordered_set<RoleName>::const_iterator _begin;
unordered_set<RoleName>::const_iterator _end;
};
+
} // namespace
RoleGraph::RoleGraph() {};
@@ -180,11 +182,10 @@ namespace {
return Status::OK();
}
- RoleNameIterator RoleGraph::getDirectSubordinates(const RoleName& role) {
+ const std::vector<RoleName>& RoleGraph::getDirectSubordinates(const RoleName& role) {
if (!roleExists(role))
- return RoleNameIterator(NULL);
- const std::vector<RoleName>& edges = _roleToSubordinates.find(role)->second;
- return RoleNameIterator(new RoleNameVectorIterator(edges.begin(), edges.end()));
+ return emptyRoleVector;
+ return _roleToSubordinates.find(role)->second;
}
RoleNameIterator RoleGraph::getIndirectSubordinates(const RoleName& role) {
@@ -194,11 +195,10 @@ namespace {
return RoleNameIterator(new RoleNameSetIterator(subs.begin(), subs.end()));
}
- RoleNameIterator RoleGraph::getDirectMembers(const RoleName& role) {
+ const std::vector<RoleName>& RoleGraph::getDirectMembers(const RoleName& role) {
if (!roleExists(role))
- return RoleNameIterator(NULL);
- const std::vector<RoleName>& edges = _roleToMembers.find(role)->second;
- return RoleNameIterator(new RoleNameVectorIterator(edges.begin(), edges.end()));
+ return emptyRoleVector;
+ return _roleToMembers.find(role)->second;
}
const PrivilegeVector& RoleGraph::getDirectPrivileges(const RoleName& role) {