Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Adding active and third_party flags to account view
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptsrc committed Mar 28, 2017
1 parent e9f8c3c commit cee324e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions security_monkey/views/account.py
Expand Up @@ -319,6 +319,8 @@ def get(self):
self.reqparse.add_argument('page', type=int, default=1, location='args')
self.reqparse.add_argument('order_by', type=str, default=None, location='args')
self.reqparse.add_argument('order_dir', type=str, default='desc', location='args')
self.reqparse.add_argument('active', type=str, default=None, location='args')
self.reqparse.add_argument('third_party', type=str, default=None, location='args')

args = self.reqparse.parse_args()
page = args.pop('page', None)
Expand All @@ -330,6 +332,12 @@ def get(self):
del args[k]

query = Account.query
if 'active' in args:
active = args['active'].lower() == "true"
query = query.filter(Account.active == active)
if 'third_party' in args:
third_party = args['third_party'].lower() == "true"
query = query.filter(Account.third_party == third_party)

if order_by and hasattr(Account, order_by):
if order_dir.lower() == 'asc':
Expand Down

0 comments on commit cee324e

Please sign in to comment.