security_verification.h
1 /*
2 * <one line to give the program's name and a brief idea of what it does.>
3 * Copyright (C) 2021 <copyright holder> <email>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef NAF_SECURITY_SECURITY_VERIFICATION
20 #define NAF_SECURITY_SECURITY_VERIFICATION
21 
22 
23 #include <string>
24 #include <list>
25 #include <stdexcept>
26 
27 #include <Poco/Tuple.h>
28 
29 #include "security/users_manager.h"
30 #include "security/permissions_manager.h"
31 #include "tools/output_logger.h"
32 
33 
34 namespace NAF
35 {
36  namespace Extras
37  {
38  enum class SecurityType;
39  class SecurityVerification;
40  }
41 }
42 
43 using namespace Poco;
44 
45 
46 enum class NAF::Extras::SecurityType
47 {
48  kDisableAll
49  ,kEnableAll
50 };
51 
53 {
54  public:
56 
57  Security::PermissionsManager& get_permissions_manager()
58  {
59  auto& var = permissions_manager_;
60  return var;
61  }
62  Security::UsersManager& get_users_manager()
63  {
64  auto& var = users_manager_;
65  return var;
66  }
67  Extras::SecurityType get_security_type() const { return security_type_; }
68 
69  void set_security_type(Extras::SecurityType security_type) { security_type_ = security_type; }
70 
71  bool VerifyRoutesPermissions_(Tools::Route& route, std::string action_type);
72 
73  private:
74  Security::PermissionsManager permissions_manager_;
75  Security::UsersManager users_manager_;
76  Extras::SecurityType security_type_;
77 };
78 
79 
80 #endif // NAF_SECURITY_SECURITY_VERIFICATION
Definition: security_verification.h:53
Definition: permissions_manager.h:46
Definition: users_manager.h:43
Definition: route.h:49