18#include <boost/shared_ptr.hpp>
29typedef boost::shared_ptr<Acl>
AclPtr;
47 isc_throw(Unexpected,
"empty access control list name");
65 virtual bool match(
const std::string& command) = 0;
98 :
Acl(
"alias"), name_(name), acl_(acl) {
108 virtual bool match(
const std::string& command)
final {
109 return (acl_->match(command));
159 virtual bool match(
const std::string& command)
final {
160 return (!acl_->match(command));
184 for (
const AclPtr& acl : acls) {
199 acls_.push_back(acl);
206 virtual bool match(
const std::string& command)
final {
207 for (
const AclPtr& acl : acls_) {
208 if (!acl->match(command)) {
236 for (
const AclPtr& acl : acls) {
251 acls_.push_back(acl);
258 virtual bool match(
const std::string& command)
final {
259 for (
const AclPtr& acl : acls_) {
260 if (acl->match(command)) {
290 virtual bool match(
const std::string&)
final {
306 virtual bool match(
const std::string&)
final {
319 :
Acl(
"commands"), commands_(commands) {
325 void add(
const std::string& command) {
327 static_cast<void>(commands_.insert(command));
333 virtual bool match(
const std::string& command)
final {
334 return (commands_.count(command) != 0);
346 std::set<std::string> commands_;
356 AccessAcl(
const std::string& access) :
Acl(
"access"), access_(access) {
362 virtual bool match(
const std::string& command)
final {
364 return (api && (api->getAccess() == access_));
386 HookAcl(
const std::string& hook) :
Acl(
"hook"), hook_(hook) {
392 virtual bool match(
const std::string& command)
final {
394 return (api && (api->getHook() == hook_));
A generic exception that is thrown when an unexpected error condition occurs.
virtual bool match(const std::string &command) final
Match the access control list.
std::string getAccess() const
Returns the access.
AccessAcl(const std::string &access)
Constructor.
Access control list base class.
static AclPtr parse(data::ConstElementPtr cfg)
Parse an access control list.
virtual bool match(const std::string &command)=0
Match the access control list.
std::string getClassName() const
Returns the class name.
static void initTable()
Initialize the access control list table.
std::string name_
The class name.
virtual ~Acl()=default
Destructor.
static AclList parseList(data::ConstElementPtr cfg)
Parse a list of access control lists.
Acl(const std::string &name)
Constructor.
AliasAcl(const std::string &name, const AclPtr &acl)
Constructor.
static void parse(data::ConstElementPtr def)
Parse an access control list definition.
std::string getName() const
Returns the name.
const AclPtr & getAcl() const
Returns the acl.
virtual bool match(const std::string &command) final
Match the access control list.
virtual bool match(const std::string &) final
Match the access control list.
virtual bool match(const std::string &command) final
Match the access control list.
const AclList & getAcls() const
Returns the acls.
AndAcl(const AclList &acls)
Constructor.
void add(const AclPtr &acl)
Add an access control list.
static ApiPtr getApiByName(const std::string &name)
Lookup in the table.
virtual bool match(const std::string &command) final
Match the access control list.
CommandsAcl(const std::set< std::string > &commands)
Constructor.
void add(const std::string &command)
Add a command name.
const std::set< std::string > & getCommands() const
Returns the command names.
virtual bool match(const std::string &command) final
Match the access control list.
HookAcl(const std::string &hook)
Constructor.
std::string getHook() const
Returns the hook.
virtual bool match(const std::string &) final
Match the access control list.
virtual bool match(const std::string &command) final
Match the access control list.
NotAcl(const AclPtr &acl)
Constructor.
const AclPtr & getAcl() const
Returns the acl.
OrAcl(const AclList &acls)
Constructor.
void add(const AclPtr &acl)
Add an access control list.
const AclList & getAcls() const
Returns the acls.
virtual bool match(const std::string &command) final
Match the access control list.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Acl > AclPtr
Type of shared pointers to Acl.
std::map< std::string, AclPtr > AclTable
Type of the access control list table.
boost::shared_ptr< Api > ApiPtr
Type of shared pointer to Api.
std::list< AclPtr > AclList
Type of list of shared pointers to Acl.
AclTable aclTable
The access control list table.
Defines the logger used by the top-level component of kea-lfc.