Fledge
An open source edge computing platform for industrial users
acl.h
1 #ifndef _ACL_H
2 #define _ACL_H
3 
4 /*
5  * Fledge ACL management
6  *
7  * Copyright (c) 2022 Dianomic Systems
8  *
9  * Released under the Apache 2.0 Licence
10  *
11  * Author: Massimiliano Pinto
12  */
13 
14 #include <string>
15 #include <vector>
16 
23 class ACL {
24  public:
25  ACL() {};
26  ACL(const std::string &json);
27  const std::string&
28  getName() { return m_name; };
29 
30  class KeyValueItem {
31  public:
32  KeyValueItem(const std::string& k,
33  const std::string& v) :
34  key(k), value(v) {};
35  std::string key;
36  std::string value;
37  };
38  class UrlItem {
39  public:
40  UrlItem(const std::string& url,
41  const std::vector<KeyValueItem>& acl) :
42  url(url), acl(acl) {};
43 
44  std::string url;
45  std::vector<KeyValueItem>
46  acl;
47  };
48 
49  public:
50  const std::vector<KeyValueItem>&
51  getService() { return m_service; };
52  const std::vector<UrlItem>&
53  getURL() { return m_url; };
54  private:
55  std::string m_name;
56  std::vector<KeyValueItem>
57  m_service;
58  std::vector<UrlItem>
59  m_url;
60 
61  public:
67  class ACLReason {
68  public:
69  ACLReason(const std::string &reason);
70  const std::string&
71  getReason() { return m_reason; };
72  const std::string&
73  getArgument() { return m_argument; };
74  private:
75  std::string m_reason;
76  std::string m_argument;
77  };
78 };
79 
80 
84 class ACLMalformed : public std::exception {
85  public:
86  virtual const char *what() const throw()
87  {
88  return "ACL JSON is malformed";
89  }
90 };
91 
95 class ACLReasonMalformed : public std::exception {
96  public:
97  virtual const char *what() const throw()
98  {
99  return "ACL Reason JSON is malformed";
100  }
101 };
102 
103 #endif
Custom exception ACLMalformed.
Definition: acl.h:84
Definition: acl.h:38
This class represents the ACL (Access Control List) as JSON object fetched from Fledge Storage...
Definition: acl.h:23
Definition: acl.h:30
This class represents the ACL security change request.
Definition: acl.h:67
Custom exception ACLReasonMalformed.
Definition: acl.h:95