diff options
author | Spencer T Brody <spencer@10gen.com> | 2012-11-06 17:56:00 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2012-11-07 17:04:39 -0500 |
commit | 288ef9cb3b6ae41afc97ba74e4cf6d15e7a1c194 (patch) | |
tree | df94221bf8f08780d694dcbfacd46232dca4f491 /src/mongo/db/auth/privilege.h | |
parent | bfbc29331726fdd2663bdcb6eeae44dce2bed200 (diff) | |
download | mongo-288ef9cb3b6ae41afc97ba74e4cf6d15e7a1c194.tar.gz |
Rename Capability to Privilege. SERVER-7126
Diffstat (limited to 'src/mongo/db/auth/privilege.h')
-rw-r--r-- | src/mongo/db/auth/privilege.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/mongo/db/auth/privilege.h b/src/mongo/db/auth/privilege.h new file mode 100644 index 00000000000..0ad0f8e20e6 --- /dev/null +++ b/src/mongo/db/auth/privilege.h @@ -0,0 +1,49 @@ +/** +* Copyright (C) 2012 10gen Inc. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License, version 3, +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include <string> + +#include "mongo/db/auth/action_set.h" +#include "mongo/db/auth/action_type.h" +#include "mongo/db/auth/principal.h" + +namespace mongo { + + /** + * A representation of the permission to perform a set of actions on a specific resource. + */ + class Privilege { + public: + + Privilege(const std::string& resource, ActionSet actions); + ~Privilege() {} + + const std::string& getResource() const { return _resource; } + + const ActionSet& getActions() const { return _actions; } + + // Checks if the given action is present in the Privilege. + bool includesAction(const ActionType& action) const; + + private: + + std::string _resource; + ActionSet _actions; // bitmask of actions this privilege grants + }; + +} // namespace mongo |