-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1015 from fecgov/release/sprint-46
Release/sprint 46
- Loading branch information
Showing
52 changed files
with
2,960 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
# Example: | ||
# 40104 2022-01-15 | ||
# | ||
71600 2024-09-01 # gunicorn <23.0.0 vulnerability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import logging | ||
|
||
|
||
from fecfiler.settings import ( | ||
FFAPI_LOGIN_DOT_GOV_COOKIE_NAME, | ||
FFAPI_COOKIE_DOMAIN, | ||
FFAPI_TIMEOUT_COOKIE_NAME, | ||
) | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def delete_user_logged_in_cookies(response): | ||
response.delete_cookie(FFAPI_LOGIN_DOT_GOV_COOKIE_NAME, domain=FFAPI_COOKIE_DOMAIN) | ||
response.delete_cookie(FFAPI_TIMEOUT_COOKIE_NAME, domain=FFAPI_COOKIE_DOMAIN) | ||
response.delete_cookie("oidc_state") | ||
response.delete_cookie("csrftoken", domain=FFAPI_COOKIE_DOMAIN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Updating Committee Views in the Database | ||
|
||
When changes are made to the Committee Account model, it is necessary to update | ||
the Committee Views for each committee in the database. To do this, create a new | ||
migration in the Committee Account app and refer to the following boilerplate code: | ||
|
||
``` | ||
from django.db import migrations | ||
from fecfiler.committee_accounts.views import create_committee_view | ||
def update_committee_views(apps, schema_editor): | ||
CommitteeAccount = apps.get_model("committee_accounts", "CommitteeAccount") # noqa | ||
for committee in CommitteeAccount.objects.all(): | ||
create_committee_view(committee.id) | ||
class Migration(migrations.Migration): | ||
dependencies = [( | ||
'committee_accounts', | ||
'XXXX_previous_migration_name' | ||
)] | ||
operations = [ | ||
migrations.RunPython( | ||
update_committee_views, | ||
migrations.RunPython.noop, | ||
), | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
from fecfiler.committee_accounts.views import ( | ||
register_committee, | ||
CommitteeMembershipViewSet, | ||
check_email_match, | ||
) | ||
from fecfiler.user.models import User | ||
from django.core.management import call_command | ||
|
@@ -189,3 +190,33 @@ def test_add_membership_requires_correct_parameters(self): | |
response.data, | ||
"This email is taken by an existing membership to this committee", | ||
) | ||
|
||
|
||
class CheckEmailMatchTestCase(TestCase): | ||
def test_no_f1_email(self): | ||
result = check_email_match("[email protected]", None) | ||
self.assertEqual(result, "No email provided in F1") | ||
|
||
def test_no_match(self): | ||
f1_emails = "[email protected];[email protected]" | ||
result = check_email_match("[email protected]", f1_emails) | ||
self.assertEqual( | ||
result, "Email [email protected] does not match committee email" | ||
) | ||
|
||
def test_match_semicolon(self): | ||
f1_emails = "[email protected];[email protected]" | ||
result = check_email_match("[email protected]", f1_emails) | ||
self.assertIsNone(result) | ||
result = check_email_match("[email protected]", f1_emails) | ||
self.assertIsNone(result) | ||
|
||
def test_match_comma(self): | ||
f1_emails = "[email protected],[email protected]" | ||
result = check_email_match("[email protected]", f1_emails) | ||
self.assertIsNone(result) | ||
|
||
def test_email_matching_case_insensitive(self): | ||
f1_emails = "[email protected];[email protected]" | ||
result = check_email_match("[email protected]", f1_emails) | ||
self.assertIsNone(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Devops | ||
|
||
A module to support devops tasks for fecfile web api. | ||
|
||
## Commands | ||
|
||
This module contains several commands (and supporting utilities) to assist devops tasks: | ||
|
||
### gen_and_stage_cert.py | ||
This command is used to generate and stage the login dot gov cert. The pk is stored in the credential service while the public cert is stored in s3. | ||
|
||
This command can be executed as follows: | ||
``` | ||
cf rt fecfile-web-api --command 'python django-backend/manage.py gen_and_stage_cert "<token>" <cf_space> <cf_creds_service_name>' | ||
``` | ||
|
||
### install_cert.py | ||
This command is used to install the staged the login dot gov cert. This should be run after the public cert is uploaded via login.gov and activated. | ||
|
||
This command can be executed as follows: | ||
``` | ||
cf rt fecfile-web-api --command 'python django-backend/manage.py install_cert "<token>" <cf_space> <cf_creds_service_name>' | ||
``` | ||
|
||
### backout_cert.py | ||
This command is used to backout the login dot gov cert after the install cert command has been run. This should be run only if we need to revert to the prior pk in the credential service. | ||
|
||
This command can be executed as follows: | ||
``` | ||
cf rt fecfile-web-api --command 'python django-backend/manage.py backout_cert "<token>" <cf_space> <cf_creds_service_name>' | ||
``` | ||
|
||
### update_creds_service.py | ||
This command is used to update the creds service with a json structure of key/value pairs. | ||
|
||
This command can be executed as follows: | ||
``` | ||
cf rt fecfile-web-api --command 'python django-backend/manage.py update_creds_service "<token>" <cf_space> <cf_creds_service_name> "<json_with_escaped_double_quotes_around_keys_and_values>"' | ||
``` |
File renamed without changes.
Oops, something went wrong.