only send notifications when superusers enabled

This commit is contained in:
Jimmy Zelinskie 2016-04-29 15:42:25 -04:00
parent b89d81d748
commit 2aa88dcb80

View file

@ -60,6 +60,7 @@ def _notify_superusers(key):
if key.expiration_date is not None:
notification_metadata['expiration_date'] = timegm(key.expiration_date.utctimetuple())
if len(config.app_config['SUPER_USERS']) > 0:
superusers = User.select().where(User.username << config.app_config['SUPER_USERS'])
for superuser in superusers:
create_notification('service_key_submitted', superuser, metadata=notification_metadata,