summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2013-09-20 10:36:01 -0400
committerAndy Schwerin <schwerin@10gen.com>2013-09-23 16:20:12 -0400
commita7f7c028c4cdda1ab0939c6c7788bb39bd94cc5f (patch)
tree270b9930bff0f280252850cd90ef0bf8e7de0a17 /src/mongo/db/commands/cleanup_orphaned_cmd.cpp
parent234f50a33cd6d2a2e0a30c4b1bddb1c7de176799 (diff)
downloadmongo-a7f7c028c4cdda1ab0939c6c7788bb39bd94cc5f.tar.gz
SERVER-1105 Use ResourcePattern type when identifying the resource component of required privileges.
This patch has two principal components. First, it changes the interface to Privilege and AuthorizationSession to use ResourcePattern in place of std::string for identifying resources. Second, it examines all call sites of the authorization session interface in commands and other code to ensure that the correct resource requirements are conveyed to the authorization_session.
Diffstat (limited to 'src/mongo/db/commands/cleanup_orphaned_cmd.cpp')
-rw-r--r--src/mongo/db/commands/cleanup_orphaned_cmd.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
index 05ad3680ffc..ced249d508b 100644
--- a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
@@ -159,9 +159,12 @@ namespace mongo {
virtual Status checkAuthForCommand( ClientBasic* client,
const std::string& dbname,
const BSONObj& cmdObj ) {
- return client->getAuthorizationSession()->checkAuthForPrivilege(
- Privilege( AuthorizationManager::CLUSTER_RESOURCE_NAME,
- ActionType::cleanupOrphaned ) );
+ if (!client->getAuthorizationSession()->isAuthorizedForActionsOnResource(
+ ResourcePattern::forClusterResource(), ActionType::cleanupOrphaned)) {
+ return Status(ErrorCodes::Unauthorized,
+ "Not authorized for cleanupOrphaned command.");
+ }
+ return Status::OK();
}
virtual LockType locktype() const { return NONE; }