delete_account_by_id(account_id) def bulk_disable_accounts(account_names): """Bulk disable accounts""" for account_name in account_names: account = Account.query.filter(Account.name == account_name).first() if account: app.logger.debug("Disabling account %s", account.name) account.active = False db.session.add(account) db.session.commit() db.session.close() def bulk_enable_accounts(account_names): """Bulk enable accounts""" for account_name in account_names: account = Account.query.filter(Account.name == account_name).first() if account: app.logger.debug("Enabling account %s", account.name) account.active = True db.session.add(account) db.session.commit() db.session.close() find_modules('account_managers')
try: from gunicorn.app.base import Application GUNICORN = True except ImportError: # Gunicorn does not yet support Windows. # See issue #524. https://github.com/benoitc/gunicorn/issues/524 # For dev on Windows, make this an optional import. print('Could not import gunicorn, skipping.') GUNICORN = False manager = Manager(app) migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) find_modules('alerters') find_modules('watchers') find_modules('auditors') load_plugins('security_monkey.plugins') @manager.command def drop_db(): """ Drops the database. """ db.drop_all() @manager.option('-a', '--accounts', dest='accounts', type=unicode,
try: from gunicorn.app.base import Application GUNICORN = True except ImportError: # Gunicorn does not yet support Windows. # See issue #524. https://github.com/benoitc/gunicorn/issues/524 # For dev on Windows, make this an optional import. print('Could not import gunicorn, skipping.') GUNICORN = False manager = Manager(app) migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) find_modules('alerters') find_modules('watchers') find_modules('auditors') load_plugins('security_monkey.plugins') @manager.command def drop_db(): """ Drops the database. """ db.drop_all() @manager.option('-a', '--accounts', dest='accounts', type=text_type, default=u'all') def run_change_reporter(accounts): """ Runs Reporter """ try:
def setup(): """Load the required data for scheduling tasks""" find_modules('alerters') find_modules('watchers') find_modules('auditors')
def setup(): """Load the required data for scheduling tasks""" find_modules('alerters') find_modules('watchers') find_modules('auditors') load_plugins('security_monkey.plugins')