|
|
|
@ -4,16 +4,23 @@ from lib.sqlitedb import SQLitedb
|
|
|
|
|
import configparser
|
|
|
|
|
import lib.uis.default as default_cmd # Follows -u, -a, -f flags
|
|
|
|
|
|
|
|
|
|
default_cmd.argparser.description += " - Lists Users from the Tilde database."
|
|
|
|
|
default_cmd.argparser.add_argument('--list', default=False, action="store_true",
|
|
|
|
|
help='Output a newline seperated list of users', required=False)
|
|
|
|
|
args = default_cmd.argparser.parse_args()
|
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
|
config.read(args.config)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ListUsers:
|
|
|
|
|
db = None
|
|
|
|
|
usersFetch = None
|
|
|
|
|
|
|
|
|
|
def __init__(self, db: str, unapproved: bool = False, approved: bool = True):
|
|
|
|
|
def __init__(self, db: str, uap: bool = False, app: bool = True):
|
|
|
|
|
self.db = SQLitedb(db)
|
|
|
|
|
if unapproved: # only unapproved users
|
|
|
|
|
if uap: # only unapproved users
|
|
|
|
|
query = "SELECT * FROM `applications` WHERE `status` = '0'"
|
|
|
|
|
elif approved: # Approved users
|
|
|
|
|
elif app: # Approved users
|
|
|
|
|
query = "SELECT * FROM `applications` WHERE `status` = '1'"
|
|
|
|
|
else: # All users
|
|
|
|
|
query = "SELECT * FROM `applications`"
|
|
|
|
@ -62,15 +69,9 @@ print(t.draw())
|
|
|
|
|
))
|
|
|
|
|
"""
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
default_cmd.argparser.description += " - Lists Users from the Tilde database."
|
|
|
|
|
default_cmd.argparser.add_argument('--list', default=False, action="store_true",
|
|
|
|
|
help='Output a newline seperated list of users', required=False)
|
|
|
|
|
args = default_cmd.argparser.parse_args()
|
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
|
config.read(args.config)
|
|
|
|
|
try:
|
|
|
|
|
ret = ""
|
|
|
|
|
L = ListUsers(config['DEFAULT']['applications_db'], unapproved=args.unapproved, approved=args.approved)
|
|
|
|
|
L = ListUsers(config['DEFAULT']['applications_db'], uap=args.unapproved, app=args.approved)
|
|
|
|
|
if args.list:
|
|
|
|
|
ret = L.outputaslist()
|
|
|
|
|
else:
|
|
|
|
|