Beispiel #1
0
        def deleteUser(self,cID):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("delete from users where ClientID = {0}".format(cID))
                conn.commit()
                c.close()
Beispiel #2
0
        def addGroup(self,g_id,gname):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("insert into groups values ( {0}, '{1}' )".format(g_id,gname))
                conn.commit();
                c.close();
Beispiel #3
0
        def deleteClientFromGroup(self,c_id,g_id):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("delete from assoc where cID = {0} and gID = {1}".format(c_id,g_id))
                conn.commit();
                c.close();
Beispiel #4
0
 def setpassword(self,password):
         conn = connection.connectDB(self.DBpath)
         c = conn.cursor()
         c.execute("delete from clientconfig")
         c.execute("insert into clientconfig(password) values ('{0}')".format(password))
         conn.commit();
         c.close();
Beispiel #5
0
 def getClientsInGroup(self, group):
         conn = connection.connectDB(self.DBpath)
         c = conn.cursor()
         c.execute("select ClientID, ClientName, gID from clients left join (select * from assoc where gID = {0}) on clients.ClientID = cID".format(group))
         clientlist=[]
         for name in c :
                 clientlist.append(name)
         return clientlist
Beispiel #6
0
        def deleteGroup(self,groupID):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("delete from groups where GroupID = '{0}'".format(groupID))
                c.execute("delete from assoc where cID = '{0}'".format(groupID));
                conn.commit();
                c.close();
Beispiel #7
0
def updateKey(username,password):
        conn = connection.connectDB(config.DB_path)
        c = conn.cursor()
        list = createKey(username,password)
        c.execute("delete from auth")
        c.execute("insert into auth values(?,?) ",list)
        conn.commit()
        c.close()
Beispiel #8
0
        def getGroupsList(self):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("select * from groups")
                grouplist = []
                for name in c :
                        grouplist.append(name)

                return grouplist
Beispiel #9
0
        def getUserList(self):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("select * from users")
                userlist=[]
                for name in c :
                        userlist.append(name)

                return userlist
Beispiel #10
0
        def addUser(self,uid,name,ip):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                if len(ip) == 0:
                        #set default IP
                        pass 
                c.execute("insert into users values ( {0}, '{1}', '{2}')".format(uid,name,ip))
                conn.commit()
                c.close()
Beispiel #11
0
        def getClientsList(self):

                conn = connection.connectDB(self.DBpath)
                c = conn.cursor()
                c.execute("select * from clients")
                clientlist=[]
                for name in c :
                        clientlist.append(name)

                return clientlist
Beispiel #12
0
def read_key():
        conn = connection.connectDB(config.DB_path)
        c = conn.cursor()
        c.execute("select * from auth")
        list = c.fetchone()
        if list == None:
                list = createKey("admin","admin")
                c.execute("insert into auth values(?,?) ",list)
                conn.commit()
        c.close() 
        return list
Beispiel #13
0
 def getchname(self,group):
         conn = connection.connectDB(self.DBpath)
         c = conn.cursor()
         c.execute("select GroupName from groups where GroupID = {0} ".format(group))
         for name in c:
                 return name[0];
Beispiel #14
0
 def addClientToGroup(self,c_id,g_id):
         conn = connection.connectDB(self.DBpath)
         c = conn.cursor()
         c.execute("insert into assoc values ( {0}, {1} )".format(c_id,g_id))
         conn.commit();
         c.close();
Beispiel #15
0
 def getPassword(self):
         conn = connection.connectDB(self.DBpath)
         c = conn.cursor()
         c.execute("select password from clientconfig")
         password = c.fetchone()[0]
         return password