tinance2-doorbot/include/ACL.h

48 lines
833 B
C++

#ifndef ACL_H
#define ACL_H
#include <Arduino.h>
#include <initializer_list>
#include <EEPROM.h>
#include <Preferences.h>
#ifdef WEB_SERVER
#ifdef WEB_SERIAL_DEBUG
#include <WebSerial.h>
#endif
#endif
struct User {
String cardId;
String desc;
};
class ACL {
public:
ACL();
ACL(std::initializer_list<User> userList);
~ACL();
void addUser(const String& cardId, const String& desc);
void updateUser(const String& cardId, const String& newCardId, const String& newdesc);
bool removeUser(const String& cardId);
bool validateAccess(const String& cardId);
int getACLSize() const;
// Additional EEPROM functions
void saveToEEPROM();
void loadFromEEPROM();
const User* getACL() const { return acl; } // Getter for acl
private:
User* acl;
int aclSize;
};
extern ACL acl;
#endif