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.
20
#include "mongo/db/auth/action_set.h"
21
#include "mongo/db/auth/action_type.h"
22
#include "mongo/db/auth/principal.h"
27
* A representation of the permission to perform a set of actions on a specific resource.
32
Privilege(const std::string& resource, const ActionType& action);
33
Privilege(const std::string& resource, const ActionSet& actions);
36
const std::string& getResource() const { return _resource; }
38
const ActionSet& getActions() const { return _actions; }
40
// Checks if the given action is present in the Privilege.
41
bool includesAction(const ActionType& action) const;
42
// Checks if the given actions are present in the Privilege.
43
bool includesActions(const ActionSet& actions) const;
47
std::string _resource;
48
ActionSet _actions; // bitmask of actions this privilege grants