mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
notify-api-412 use black to enforce python coding style
This commit is contained in:
@@ -18,7 +18,9 @@ def user_has_permissions(*permissions, **permission_kwargs):
|
||||
if not current_user.has_permissions(*permissions, **permission_kwargs):
|
||||
abort(403)
|
||||
return func(*args, **kwargs)
|
||||
|
||||
return wrap_func
|
||||
|
||||
return wrap
|
||||
|
||||
|
||||
@@ -30,6 +32,7 @@ def user_is_gov_user(f):
|
||||
if not current_user.is_gov_user:
|
||||
abort(403)
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return wrapped
|
||||
|
||||
|
||||
@@ -41,23 +44,24 @@ def user_is_platform_admin(f):
|
||||
if not current_user.platform_admin:
|
||||
abort(403)
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return wrapped
|
||||
|
||||
|
||||
def is_gov_user(email_address):
|
||||
return _email_address_ends_with(
|
||||
email_address, config.Config.GOVERNMENT_EMAIL_DOMAIN_NAMES
|
||||
) or _email_address_ends_with(
|
||||
email_address, organizations_client.get_domains()
|
||||
)
|
||||
) or _email_address_ends_with(email_address, organizations_client.get_domains())
|
||||
|
||||
|
||||
def _email_address_ends_with(email_address, known_domains):
|
||||
return any(
|
||||
email_address.lower().endswith((
|
||||
"@{}".format(known),
|
||||
".{}".format(known),
|
||||
))
|
||||
email_address.lower().endswith(
|
||||
(
|
||||
"@{}".format(known),
|
||||
".{}".format(known),
|
||||
)
|
||||
)
|
||||
for known in known_domains
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user