def _permCheck(self, cu, instanceTblName):
        # returns a list of instance id's we're allowed to see
        sql = """
        DELETE FROM %s WHERE instanceId NOT IN
            (SELECT DISTINCT ugi.instanceId
             FROM %s JOIN UserGroupInstancesCache as ugi ON
             %s.instanceId = ugi.instanceId
             WHERE
                ugi.userGroupId IN (%s))
        """ % (instanceTblName, instanceTblName, instanceTblName,
               ",".join("%d" % x for x in self.roleIds))
        cu.execute(sql, start_transaction = False)
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/fsrepos.py/_TroveListWrapper._permCheck/original