31 #ifndef BASELIB_SECURITY_ACL_H_ 32 #define BASELIB_SECURITY_ACL_H_ 34 #include "../Exception.h" 35 #include "../Variable.h" 36 #include "../Database/IDatabaseController.h" 116 bool _devicesReadSet =
false;
123 std::unordered_map<uint64_t, bool> _devicesRead;
128 bool _devicesWriteSet =
false;
135 std::unordered_map<uint64_t, bool> _devicesWrite;
140 bool _variablesReadSet =
false;
153 std::unordered_map<uint64_t, std::unordered_map<int32_t, std::unordered_map<std::string, bool>>> _variablesRead;
158 bool _variablesWriteSet =
false;
171 std::unordered_map<uint64_t, std::unordered_map<int32_t, std::unordered_map<std::string, bool>>> _variablesWrite;
176 bool _roomsReadSet =
false;
181 std::unordered_map<uint64_t, bool> _roomsRead;
186 bool _roomsWriteSet =
false;
193 std::unordered_map<uint64_t, bool> _roomsWrite;
198 bool _buildingPartsReadSet =
false;
203 std::unordered_map<uint64_t, bool> _buildingPartsRead;
208 bool _buildingPartsWriteSet =
false;
215 std::unordered_map<uint64_t, bool> _buildingPartsWrite;
220 bool _categoriesReadSet =
false;
227 std::unordered_map<uint64_t, bool> _categoriesRead;
232 bool _categoriesWriteSet =
false;
237 std::unordered_map<uint64_t, bool> _categoriesWrite;
242 bool _rolesReadSet =
false;
249 std::unordered_map<uint64_t, bool> _rolesRead;
254 bool _rolesWriteSet =
false;
259 std::unordered_map<uint64_t, bool> _rolesWrite;
264 bool _methodsSet =
false;
272 std::unordered_map<std::string, bool> _methods;
277 bool _eventServerMethodsSet =
false;
285 std::unordered_map<std::string, bool> _eventServerMethods;
290 bool _servicesSet =
false;
298 std::unordered_map<std::string, bool> _services;
327 void fromVariable(
PVariable serializedData);
329 AclResult checkServiceAccess(std::string &serviceName);
330 AclResult checkCategoriesReadAccess(std::set<uint64_t> &categories);
331 AclResult checkCategoriesWriteAccess(std::set<uint64_t> &categories);
332 AclResult checkCategoryReadAccess(uint64_t category);
333 AclResult checkCategoryWriteAccess(uint64_t category);
334 AclResult checkRolesReadAccess(std::set<uint64_t> &roles);
335 AclResult checkRolesWriteAccess(std::set<uint64_t> &roles);
337 AclResult checkRoleWriteAccess(uint64_t role);
338 AclResult checkDeviceReadAccess(std::shared_ptr<Systems::Peer> peer);
339 AclResult checkDeviceWriteAccess(std::shared_ptr<Systems::Peer> peer);
340 AclResult checkEventServerMethodAccess(std::string &methodName);
341 AclResult checkMethodAccess(std::string &methodName);
342 AclResult checkMethodAndCategoryReadAccess(std::string &methodName, uint64_t categoryId);
343 AclResult checkMethodAndCategoryWriteAccess(std::string &methodName, uint64_t categoryId);
344 AclResult checkMethodAndRoleReadAccess(std::string &methodName, uint64_t roleId);
345 AclResult checkMethodAndRoleWriteAccess(std::string &methodName, uint64_t roleId);
346 AclResult checkMethodAndRoomReadAccess(std::string &methodName, uint64_t roomId);
347 AclResult checkMethodAndRoomWriteAccess(std::string &methodName, uint64_t roomId);
348 AclResult checkMethodAndBuildingPartReadAccess(std::string &methodName, uint64_t buildingPartId);
349 AclResult checkMethodAndBuildingPartWriteAccess(std::string &methodName, uint64_t buildingPartId);
350 AclResult checkMethodAndDeviceWriteAccess(std::string &methodName, uint64_t
peerId);
351 AclResult checkNodeBlueVariableReadAccess(
const std::string &nodeId, int32_t
input);
352 AclResult checkNodeBlueVariableWriteAccess(
const std::string &nodeId, int32_t input);
353 AclResult checkRoomReadAccess(uint64_t roomId);
354 AclResult checkRoomWriteAccess(uint64_t roomId);
355 AclResult checkBuildingPartReadAccess(uint64_t buildingPartId);
356 AclResult checkBuildingPartWriteAccess(uint64_t buildingPartId);
359 AclResult checkVariableReadAccess(std::shared_ptr<Systems::Peer> peer, int32_t
channel,
const std::string &variableName);
360 AclResult checkVariableWriteAccess(std::shared_ptr<Systems::Peer> peer, int32_t channel,
const std::string &variableName);
362 std::string toString(int32_t indentation = 0);
365 typedef std::shared_ptr<Acl>
PAcl;
bool rolesReadSet()
Definition: Acl.h:309
bool roomsReadSet()
Definition: Acl.h:313
Exception class for Acl.
Definition: Acl.h:60
std::shared_ptr< SystemVariable > PSystemVariable
Definition: IDatabaseController.h:51
std::shared_ptr< Acl > PAcl
Definition: Acl.h:365
bool variablesWriteSet()
Definition: Acl.h:318
Definition: BaseLib.cpp:34
bool devicesWriteSet()
Definition: Acl.h:312
AclException(std::string message)
Definition: Acl.h:62
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
int32_t channel
Definition: UiElements.h:215
AclResult
Definition: Acl.h:48
bool roomsWriteSet()
Definition: Acl.h:314
This class is used to store ACL rules.
Definition: Acl.h:111
uint64_t peerId
Definition: UiElements.h:214
bool rolesWriteSet()
Definition: Acl.h:310
bool buildingPartsWriteSet()
Definition: Acl.h:316
bool categoriesWriteSet()
Definition: Acl.h:308
Base class for all exceptions defined in Homegear.
Definition: Exception.h:41
bool categoriesReadSet()
Definition: Acl.h:307
bool variablesReadSet()
Definition: Acl.h:317
bool devicesReadSet()
Definition: Acl.h:311
bool buildingPartsReadSet()
Definition: Acl.h:315