1
/* Copyright 2012 10gen Inc.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
16
#include "mongo/db/auth/principal.h"
18
#include <boost/date_time/posix_time/posix_time.hpp>
21
#include "mongo/util/map_util.h"
25
Principal::Principal(const PrincipalName& name) :
27
_expirationTime(boost::posix_time::pos_infin),
28
_enableImplicitPrivileges(false) {
31
Principal::~Principal() {}
33
void Principal::setExpirationTime(boost::posix_time::ptime& expiration) {
34
_expirationTime = expiration;
37
void Principal::setImplicitPrivilegeAcquisition(bool enabled) {
38
_enableImplicitPrivileges = enabled;
41
bool Principal::isDatabaseProbed(const StringData& dbname) const {
42
return mapFindWithDefault(_probedDatabases, dbname, false);
45
void Principal::markDatabaseAsProbed(const StringData& dbname) {
46
_probedDatabases[dbname] = true;