diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2021-03-08 12:03:40 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-08 17:58:19 +0000 |
commit | 2a7183bad6b412fe97f464679b2a49eb46b47eec (patch) | |
tree | a0194e1f4f2be52980eda60290baf96f55f45d26 /src/mongo/idl/idl_test.cpp | |
parent | dc009c5a8d484f6a0db2f357274e14e30ea9f476 (diff) | |
download | mongo-2a7183bad6b412fe97f464679b2a49eb46b47eec.tar.gz |
SERVER-54521 Extend access_check for simple and privileges
Diffstat (limited to 'src/mongo/idl/idl_test.cpp')
-rw-r--r-- | src/mongo/idl/idl_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/idl/idl_test.cpp b/src/mongo/idl/idl_test.cpp index e4e40683edd..bc4780c43e4 100644 --- a/src/mongo/idl/idl_test.cpp +++ b/src/mongo/idl/idl_test.cpp @@ -37,6 +37,7 @@ #include "mongo/bson/bsontypes.h" #include "mongo/bson/oid.h" #include "mongo/db/auth/authorization_contract.h" +#include "mongo/db/auth/resource_pattern.h" #include "mongo/idl/unittest_gen.h" #include "mongo/rpc/op_msg.h" #include "mongo/unittest/bson_test_util.h" @@ -3685,6 +3686,13 @@ TEST(IDLAccessCheck, TestSimpleAccessCheck) { verifyContract(ac, AccessCheckSimpleAccessCheck::kAuthorizationContract); } +TEST(IDLAccessCheck, TestSimplePrivilegeAccessCheck) { + AuthorizationContract ac; + ac.addPrivilege(Privilege(ResourcePattern::forClusterResource(), ActionType::addShard)); + ac.addPrivilege(Privilege(ResourcePattern::forClusterResource(), ActionType::serverStatus)); + + verifyContract(ac, AccessCheckSimplePrivilege::kAuthorizationContract); +} } // namespace } // namespace mongo |