Esempio n. 1
0
 def getGroupServerDomains(self, gid):
     return sql.select([self.serverusers.c.domain],
                       sql.and_(
                           self.servergroup.c.gid == gid,
                           self.serverusers.c.sid == self.servergroup.c.sid,
                       ),
                       group_by=[self.serverusers.c.domain
                                 ]).execute().fetchall()
Esempio n. 2
0
 def getServerMembership(self, sid):
     return sql.select(
         [
             self.servergroup.c.sid,
             self.servergroup.c.gid,
             self.groups.c.name,
         ],
         sql.and_(self.servergroup.c.sid == sid, self.groups.c.id ==
                  self.servergroup.c.gid)).execute().fetchall()
Esempio n. 3
0
 def getMembership(self, uid):
     return sql.select([
         self.usergroup.c.uid,
         self.usergroup.c.gid,
         self.groups.c.name,
     ],
                       sql.and_(self.usergroup.c.uid == uid,
                                self.groups.c.id ==
                                self.usergroup.c.gid)).execute().fetchall()
Esempio n. 4
0
 def getUsersFromSGroup(self, gid):
     return sql.select(
         [
             self.serverusers.c.id, self.serverusers.c.sid,
             self.serverusers.c.domain, self.serverusers.c.name,
             self.serverusers.c.giveName
         ],
         sql.and_(self.serverusers.c.sid == self.servergroup.c.sid,
                  self.servergroup.c.gid == gid),
         order_by=[self.serverusers.c.name]).execute().fetchall()
Esempio n. 5
0
 def getDomainMemberships(self):
     return sql.select([
         self.domaingroup.c.did,
         self.domaingroup.c.gid,
         self.groups.c.name,
         self.domains.c.domain,
     ],
                       sql.and_(self.domaingroup.c.gid == self.groups.c.id,
                                self.domaingroup.c.did ==
                                self.domains.c.id)).execute().fetchall()
Esempio n. 6
0
 def getServerUsersByDomain(self, domain, gid):
     return sql.select([
         self.serverusers.c.id, self.serverusers.c.name, self.server.c.name
     ],
                       sql.and_(
                           self.serverusers.c.domain == domain,
                           self.server.c.id == self.serverusers.c.sid,
                           self.servergroup.c.sid == self.serverusers.c.sid,
                           self.servergroup.c.gid == gid),
                       group_by=[self.serverusers.c.name
                                 ]).execute().fetchall()
Esempio n. 7
0
 def getServerEvents(self, sid):
     return sql.select(
         [
             self.log.c.date,
             self.log.c.type,
             self.log.c.message,
         ],
         self.log.c.sid == sid,
         order_by=[sql.desc(self.log.c.date)],
         limit=20,
     ).execute().fetchall()
Esempio n. 8
0
 def listPendingOrders(self):
     return sql.select([
         self.orders.c.id, self.orders.c.uid, self.orders.c.sid,
         self.orders.c.name, self.orders.c.hostname, self.orders.c.type,
         self.orders.c.support, self.orders.c.status, self.orders.c.created,
         self.orders.c.modified, self.users.c.fullname
     ],
                       sql.and_(
                           self.users.c.id == self.orders.c.uid,
                           sql.or_(self.orders.c.status != "Completed",
                                   self.orders.c.status == None)),
                       order_by=[self.orders.c.modified
                                 ]).execute().fetchall()
Esempio n. 9
0
 def getDomainsInGroup(self, gids):
     """ Get all the domains viewable in C(list) of groups """
     result = []
     for gid in gids:
         query = sql.select(
             [
                 self.domains.c.id,
                 self.domains.c.domain,
             ],
             sql.and_(self.domaingroup.c.gid == gid, self.domains.c.id ==
                      self.domaingroup.c.did)).execute().fetchall()
         for r in query:
             result.append(r)
     return result
Esempio n. 10
0
    def getServersInGroup(self, gids):
        """ Get all the servers in a C(list) of groups """
        result = []

        for gid in gids:
            query = sql.select(
                [
                    self.server.c.id, self.server.c.name,
                    self.server.c.hostname, self.server.c.skey,
                    self.server.c.lasthost, self.server.c.lastversion
                ],
                sql.and_(self.servergroup.c.gid == gid, self.server.c.id ==
                         self.servergroup.c.sid)).execute().fetchall()
            for r in query:
                result.append(r)

        return result
Esempio n. 11
0
 def getServerUserById(self, uid, gid):
     return sql.select(
         [
             self.serverusers.c.id, self.serverusers.c.sid,
             self.serverusers.c.domain, self.serverusers.c.name,
             self.serverusers.c.giveName, self.serverusers.c.sn,
             self.serverusers.c.cn, self.serverusers.c.uid,
             self.serverusers.c.gid, self.serverusers.c.emp,
             self.serverusers.c.active, self.serverusers.c.mail,
             self.serverusers.c.mailForward, self.serverusers.c.mailAlias,
             self.serverusers.c.ntPass, self.serverusers.c.password,
             self.serverusers.c.lmPass, self.serverusers.c.samSid,
             self.serverusers.c.pgSid, self.serverusers.c.vacation,
             self.serverusers.c.vacEnable, self.serverusers.c.flags
         ],
         sql.and_(self.serverusers.c.id == uid,
                  self.servergroup.c.sid == self.serverusers.c.sid,
                  self.servergroup.c.gid in gid)).execute().fetchone()
Esempio n. 12
0
 def getServerForUser(self, uid):
     return sql.select(
         [self.server.c.id, self.server.c.name],
         sql.and_(self.serverusers.c.id == uid, self.server.c.id ==
                  self.serverusers.c.sid)).execute().fetchone()
Esempio n. 13
0
 def getGroupUsers(self, gid):
     return sql.select([self.users.c.id, self.users.c.username],
                       sql.and_(
                           self.usergroup.c.gid == gid,
                           self.users.c.id == self.usergroup.c.uid,
                       )).execute().fetchall()