Beispiel #1
0
 def findAllWorkingByEndpoint(cls, endpoint):
     ret = []
     c = dbConn.get().cursor()
     for row in c.execute(
             'SELECT user,cred FROM connections WHERE working=1 AND endpoint=? ORDER BY root ASC',
         (endpoint.getId(), )):
         ret.append(
             Connection(endpoint, User.find(row[0]), Creds.find(row[1])))
     c.close()
     return ret
Beispiel #2
0
 def findWorkingByEndpoint(cls, endpoint):
     c = dbConn.get().cursor()
     c.execute(
         'SELECT user,cred FROM connections WHERE working=1 AND endpoint=? ORDER BY root ASC',
         (endpoint.getId(), ))
     row = c.fetchone()
     c.close()
     if row is None:
         return None
     return Connection(endpoint, User.find(row[0]), Creds.find(row[1]))
Beispiel #3
0
 def findByCreds(cls, creds):
     ret = []
     c = dbConn.get().cursor()
     for row in c.execute(
             'SELECT endpoint,user FROM connections WHERE cred=?',
         (creds.getId(), )):
         ret.append(
             Connection(Endpoint.find(row[0]), User.find(row[1]), creds))
     c.close()
     return ret
Beispiel #4
0
 def findByEndpoint(cls, endpoint):
     ret = []
     c = dbConn.get().cursor()
     for row in c.execute(
             'SELECT user,cred FROM connections WHERE endpoint=?',
         (endpoint.getId(), )):
         ret.append(
             Connection(endpoint, User.find(row[0]), Creds.find(row[1])))
     c.close()
     return ret
Beispiel #5
0
 def find(cls, connectionId):
     c = dbConn.get().cursor()
     c.execute('SELECT endpoint,user,cred FROM connections WHERE id=?',
               (connectionId, ))
     row = c.fetchone()
     c.close()
     if row is None:
         return None
     return Connection(Endpoint.find(row[0]), User.find(row[1]),
                       Creds.find(row[2]))
Beispiel #6
0
 def parseOptionsTarget(self):
     user = self.getOption("user")
     if user is None:
         users = self.getUsers(scope=True)
     else:
         users = [User.find(user.getId())]
     endpoint = self.getOption("endpoint")
     if endpoint is None:
         endpoints = self.getEndpoints(scope=True)
     else:
         endpoints = [Endpoint.find(endpoint.getId())]
     cred = self.getOption("creds")
     if cred is None:
         creds = self.getCreds(scope=True)
     else:
         creds = [Creds.find(cred.getId())]
     return (endpoints,users,creds)