summaryrefslogtreecommitdiff
path: root/users.h
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2009-09-08 17:50:00 (GMT)
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2009-09-08 17:50:00 (GMT)
commit1a19a11081e56aff745ca0ba625187fabc54fb94 (patch)
tree4690ff63020d7762b1ffbac1dcc697e07989c07a /users.h
parent4cf240cb6faa33f1e51d1040ee6162f245525f8f (diff)
downloadvdr-plugin-live-1a19a11081e56aff745ca0ba625187fabc54fb94.tar.gz
vdr-plugin-live-1a19a11081e56aff745ca0ba625187fabc54fb94.tar.bz2
new files for user management
Diffstat (limited to 'users.h')
-rw-r--r--users.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/users.h b/users.h
new file mode 100644
index 0000000..b845352
--- /dev/null
+++ b/users.h
@@ -0,0 +1,69 @@
+#ifndef VDR_LIVE_USERS_H
+#define VDR_LIVE_USERS_H
+
+#include <string>
+#include <vdr/plugin.h>
+#include <vdr/tools.h>
+#include <iostream>
+#include <sstream>
+
+namespace vdrlive {
+
+enum eUserRights
+{
+ UR_EDITSETUP=1,
+ UR_EDITTIMERS,
+ UR_DELTIMERS,
+ UR_DELRECS,
+ UR_USEREMOTE,
+ UR_STARTREPLAY,
+ UR_SWITCHCHNL,
+ UR_EDITSTIMERS,
+ UR_DELSTIMERS
+};
+
+// --- cUser --------------------------------------------------------
+class cUser : public cListObject {
+ int m_ID;
+ std::string m_Name;
+ std::string m_PasswordMD5;
+ int m_Userrights;
+public:
+ cUser() : m_ID(-1), m_Userrights(0) {}
+ cUser(int ID, const std::string& Name, const std::string& Password);
+ int Id() const { return m_ID; }
+ std::string Name() const { return m_Name; }
+ std::string PasswordMD5() const { return m_PasswordMD5; }
+ int Userrights() const { return m_Userrights; }
+ int GetPasswordLength() const;
+ std::string const GetMD5HashPassword() const;
+ void SetId(int Id) { m_ID = Id; }
+ void SetName(const std::string Name) { m_Name = Name; }
+ void SetPassword(const std::string Password);
+ void SetUserrights(int Userrights) { m_Userrights = Userrights; }
+ bool HasRightTo(eUserRights right);
+ static bool CurrentUserHasRightTo(eUserRights right);
+ void SetRight(eUserRights right);
+ bool Parse(const char *s);
+ const char *ToText(void);
+ bool Save(FILE *f);
+};
+
+// --- cUsers --------------------------------------------------------
+class cUsers : public cConfig<cUser> {
+ public:
+ bool ValidUserLogin(const std::string& login, const std::string& password);
+ bool ValidLogin(const std::string& login, const std::string& password);
+ bool Delete(const std::string& Name);
+ static cUser* GetByUserId(const std::string& Id);
+ static cUser* GetByUserName(const std::string& Name);
+ int GetNewId();
+
+ static std::string logged_in_user;
+};
+
+extern cUsers Users;
+
+}
+
+#endif