Make permission values 0 based but stsarting with UNKNOWN because when doing permission+0 in SQL, we get a 1-based value
parent
d583c10fa6
commit
7fda500140
|
@ -64,7 +64,7 @@ Group_Permission::Permission Group_Permission::getPermission(int monitor_id) {
|
|||
|
||||
std::vector<Group_Permission> Group_Permission::find(int p_user_id) {
|
||||
std::vector<Group_Permission> results;
|
||||
std::string sql = stringtf("SELECT `Id`,`UserId`,`GroupId`,`Permission` FROM Groups_Permissions WHERE `UserId`='%d'", p_user_id);
|
||||
std::string sql = stringtf("SELECT `Id`,`UserId`,`GroupId`,`Permission`+0 FROM Groups_Permissions WHERE `UserId`='%d'", p_user_id);
|
||||
|
||||
MYSQL_RES *result = zmDbFetch(sql.c_str());
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
class Group_Permission {
|
||||
public:
|
||||
typedef enum { PERM_INHERIT=0, PERM_NONE = 1, PERM_VIEW, PERM_EDIT } Permission;
|
||||
typedef enum { PERM_UNKNOWN=0, PERM_INHERIT, PERM_NONE, PERM_VIEW, PERM_EDIT } Permission;
|
||||
|
||||
protected:
|
||||
int id;
|
||||
|
|
|
@ -47,7 +47,7 @@ void Monitor_Permission::Copy(const Monitor_Permission &mp) {
|
|||
|
||||
std::vector<Monitor_Permission> Monitor_Permission::find(int p_user_id) {
|
||||
std::vector<Monitor_Permission> results;
|
||||
std::string sql = stringtf("SELECT `Id`,`UserId`,`MonitorId`,`Permission` FROM Monitors_Permissions WHERE `UserId`='%d'", p_user_id);
|
||||
std::string sql = stringtf("SELECT `Id`,`UserId`,`MonitorId`,`Permission`+0 FROM Monitors_Permissions WHERE `UserId`='%d'", p_user_id);
|
||||
|
||||
MYSQL_RES *result = zmDbFetch(sql.c_str());
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
class Monitor_Permission {
|
||||
public:
|
||||
typedef enum { PERM_INHERIT=0, PERM_NONE = 1, PERM_VIEW, PERM_EDIT } Permission;
|
||||
typedef enum { PERM_UNKNOWN=0, PERM_INHERIT, PERM_NONE, PERM_VIEW, PERM_EDIT } Permission;
|
||||
|
||||
protected:
|
||||
int id;
|
||||
|
|
Loading…
Reference in New Issue