diff options
Diffstat (limited to 'src/mongo/db/auth/user.cpp')
-rw-r--r-- | src/mongo/db/auth/user.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/auth/user.cpp b/src/mongo/db/auth/user.cpp index 0dcc7d3ff76..03ef82bbe1b 100644 --- a/src/mongo/db/auth/user.cpp +++ b/src/mongo/db/auth/user.cpp @@ -73,6 +73,22 @@ namespace mongo { _credentials = credentials; } + void User::setRoleData(const std::vector<User::RoleData>& roles) { + _roles.clear(); + for (size_t i = 0; i < roles.size(); ++i) { + const User::RoleData& role = roles[i]; + _roles[role.name] = role; + } + } + + void User::setPrivileges(const PrivilegeVector& privileges) { + _privileges.clear(); + for (size_t i = 0; i < privileges.size(); ++i) { + const Privilege& privilege = privileges[i]; + _privileges[privilege.getResourcePattern()] = privilege; + } + } + void User::addRole(const RoleName& roleName) { RoleData& role = _roles[roleName]; if (role.name.empty()) { |