diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/auth/privilege.h | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/auth/privilege.h')
-rw-r--r-- | src/mongo/db/auth/privilege.h | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/src/mongo/db/auth/privilege.h b/src/mongo/db/auth/privilege.h index 1009172a30c..da6b054e012 100644 --- a/src/mongo/db/auth/privilege.h +++ b/src/mongo/db/auth/privilege.h @@ -36,47 +36,50 @@ namespace mongo { - class Privilege; - typedef std::vector<Privilege> PrivilegeVector; +class Privilege; +typedef std::vector<Privilege> PrivilegeVector; +/** + * A representation of the permission to perform a set of actions on a resource. + */ +class Privilege { +public: /** - * A representation of the permission to perform a set of actions on a resource. + * Adds "privilegeToAdd" to "privileges", de-duping "privilegeToAdd" if the vector already + * contains a privilege on the same resource. + * + * This method is the preferred way to add privileges to privilege vectors. */ - class Privilege { - public: - /** - * Adds "privilegeToAdd" to "privileges", de-duping "privilegeToAdd" if the vector already - * contains a privilege on the same resource. - * - * This method is the preferred way to add privileges to privilege vectors. - */ - static void addPrivilegeToPrivilegeVector(PrivilegeVector* privileges, - const Privilege& privilegeToAdd); - + static void addPrivilegeToPrivilegeVector(PrivilegeVector* privileges, + const Privilege& privilegeToAdd); - Privilege() {}; - Privilege(const ResourcePattern& resource, const ActionType& action); - Privilege(const ResourcePattern& resource, const ActionSet& actions); - ~Privilege() {} - const ResourcePattern& getResourcePattern() const { return _resource; } + Privilege(){}; + Privilege(const ResourcePattern& resource, const ActionType& action); + Privilege(const ResourcePattern& resource, const ActionSet& actions); + ~Privilege() {} - const ActionSet& getActions() const { return _actions; } + const ResourcePattern& getResourcePattern() const { + return _resource; + } - void addActions(const ActionSet& actionsToAdd); - void removeActions(const ActionSet& actionsToRemove); + const ActionSet& getActions() const { + return _actions; + } - // Checks if the given action is present in the Privilege. - bool includesAction(const ActionType& action) const; - // Checks if the given actions are present in the Privilege. - bool includesActions(const ActionSet& actions) const; + void addActions(const ActionSet& actionsToAdd); + void removeActions(const ActionSet& actionsToRemove); - BSONObj toBSON() const; + // Checks if the given action is present in the Privilege. + bool includesAction(const ActionType& action) const; + // Checks if the given actions are present in the Privilege. + bool includesActions(const ActionSet& actions) const; - private: + BSONObj toBSON() const; - ResourcePattern _resource; - ActionSet _actions; // bitmask of actions this privilege grants - }; +private: + ResourcePattern _resource; + ActionSet _actions; // bitmask of actions this privilege grants +}; -} // namespace mongo +} // namespace mongo |