1307 Commits

Author SHA1 Message Date
graham-dds
07b4238c2b Write tests for multi checkbox input vue component 2019-12-13 13:17:30 -05:00
graham-dds
a097a0ce61 Refactor New Portfolio page according to designs.
New designs call for a streamlined New Portfolio page, with far
fewer input options. This commit refactors that page according to those
designs.

Some of the route functions in this commit refer to a "step 1" of creating
a new Portfolio. Though there is no "step 2" right now, the designs call
for a multistep flow for Portfolio creation process, so this commit sets
the stage for that.
2019-12-13 13:17:30 -05:00
leigh-mil
1550f32b4c
Merge branch 'staging' into to-index-page-redesign_part-3 2019-12-13 13:01:11 -05:00
leigh-mil
2552d4c700 Styling for empty status accordion and update Not signed to Unsigned 2019-12-13 11:49:50 -05:00
dandds
8f94d9e6ec Log any CSP errors that occur when disabling a user.
When one user disables another's environment role in Azure, sometimes an
exception will be raised. Since we catch the exception and display an
error message to the user, we should also log the exception so that the
error is traceable later.
2019-12-13 11:41:18 -05:00
tomdds
8a1ed5b193 Sketch in Management Group integration for Azure
Add mocks and real implementations for creating nested management groups that reflect the Portfolio->Application->Environment->Subscription hierarchy.
2019-12-13 10:53:24 -05:00
leigh-mil
ac8dd662d1 Fake task order's expended funds, default task order start and end date to None, fix how task orders are sorted by status 2019-12-12 09:40:18 -05:00
leigh-mil
e32bad0d30 Display TOs grouped by status 2019-12-12 09:40:18 -05:00
leigh-mil
d3f757c649 Update test_for_user to make variables clearer and add in a test case that should not be included in the list returned.
Use list comprehension in portfolio_applications route to get list of all environments for a user
2019-12-11 10:35:42 -05:00
leigh-mil
02efa33e49 Display users env role if they have environment access 2019-12-11 10:07:09 -05:00
graham-dds
29644a495b Add tests (& placeholder tests) for new reporting 2019-12-10 11:23:53 -05:00
dandds
f8c31e4dcf Add function for Flask app to read config from a directory.
The application now checks for an environment variable,
OVERRIDE_CONFIG_DIRECTORY. If that value is set, it loops all the files
in the specified directory and checks if their names correspond to known
configuration settings. The contents of any matching files are read and
set as the new configuration value for that setting. This will allow us
to read mounted Azure Key Vault items as config values.

This also moves the functionality for applying environment variables to
the config into an analogous function.
2019-12-10 10:14:53 -05:00
leigh-mil
8330b4de24 Check to see if the env_role has been provisioned before disabling env_role in the csp 2019-12-06 09:59:56 -05:00
leigh-mil
c501431719 Check to see if the environment has been provisioned before disabling the env role in the csp 2019-12-06 09:53:36 -05:00
leigh-mil
74ff581570 Remove route for /portfolios 2019-12-03 15:43:06 -05:00
leigh-mil
614514d6a2 Update tables to match business logic 2019-12-02 14:46:11 -05:00
graham-dds
92ae191f37
Merge pull request #1199 from dod-ccpo/reporting-refactor-part-1
Reporting refactor part 1
2019-11-25 16:37:49 -05:00
graham-dds
0303434561 First pass at new reporting designs
This commit lays out the genral structure and provides necessary
data for the new reporting page designs.

Some of the data generated by the report domain classes (including
the mock CSP reporting class) was modified to fit new designs. This also
included removing data that was no longer necessary. Part of the newly
mocked data includes the idea of "expended" data per CLIN or task order.
This was was mocked simply by using a 75% of the obligated funds fo a
given object. Tests were also written for these new/ modifed reporting
functions.

As for the front end, this commit only focuses on the high-level markup
layout. This includes splitting the large reporting index page into
smaller component templates for each of the major sections of the report.
2019-11-25 13:12:35 -05:00
graham-dds
7a0dc4d264 Add properties to portfolio model
1. Funding duration

Returns a tuple of the earliest period of performance start date and
latest period of performance end date for all active task order in a  portfolio.

2. Days to funding expiration
Returns the numbei of days between today and the lastest
period performance end date of all active task orders

3. Active task orders
Returns a list of a portfolio's active task orders a
2019-11-25 13:12:35 -05:00
graham-dds
d4cc887f80 add signed_at field to TaskOrderFactory 2019-11-25 13:12:34 -05:00
dandds
9ae20b4a2a JSON logging for Celery workers.
This enables JSON logging for Celery workers if the LOG_JSON conig value
is set. It uses the same JsonFormatter class used by the Flask
applications. That class has been updated in two ways:

- It takes a `source` kwarg to define the log source for the formatter.
- The `msg` attribute of the log record is formatted with any arguments
  that may have been passed. This is necessary for Celery to render task
  type, completion time, etc. into the log output.
2019-11-25 10:13:37 -05:00
leigh-mil
c2975fff69
Merge pull request #1192 from dod-ccpo/app-member-status-labels
Status labels on app members table
2019-11-22 08:23:26 -05:00
leigh-mil
dd148f0837 exclude audit log related functions from coverage 2019-11-20 13:46:44 -05:00
leigh-mil
ef12701dbb Default creating an invite in the AppliationRoleFactory to True and fix tests 2019-11-20 12:09:46 -05:00
leigh-mil
8aa302357b Move label display logic into the Label macro 2019-11-20 12:09:46 -05:00
leigh-mil
58a0b2dd9d Move display status logic to be a property of an ApplicationRole 2019-11-20 12:08:41 -05:00
leigh-mil
9f90f5abbd Update app member status labels to accurately reflect member's current status 2019-11-20 11:59:48 -05:00
graham-dds
fea8c9bce9 Remove developer styleguide from project
Since we're actively moving our styles toward a pure of a USWDS
implementation as possible, this styleguide page is becoming
increasingly outdated.
2019-11-19 13:34:14 -05:00
leigh-mil
7c8717c2fe Add tests for the applications.new routes for adding a new member and updating a member
Add tests for creating and updating app member helper methods
2019-11-18 14:09:52 -05:00
leigh-mil
a4f21dc7e6 Prevent error from being raised when user is not trying to update a
disabled env role

We were only checking to see if a role was disabled or deleted before
raising an error, so I added in a check to see if the user was trying to
update the env role before raising an error. The error should only be
raised if the role is disabled or deleted AND the user is trying to
assign a new role to the env role.

I also added in a disabled property to the EnvironmentRole model to make
things more readable.
2019-11-15 09:51:02 -05:00
dandds
3ddfc5c179 Fix bug in static CRL test.
A CRL test that relies on fixtures files was not getting a working copy
of the relevant CRL list it needed. This also adds a setup function to
the relevant test module so that we can clear and rebuild the CRL
location cache for the fixtures.
2019-11-14 14:12:07 -05:00
dandds
9c086e2f85
Merge pull request #1177 from dod-ccpo/crls-again
Maintain static list of CRL URIs and issuers.
2019-11-14 05:45:51 -05:00
leigh-mil
06a36f23bc Raise error when a user attempts to update a disabled env role 2019-11-12 17:02:57 -05:00
leigh-mil
e8f21acf5b PR fixes 2019-11-12 16:59:22 -05:00
leigh-mil
f928b776a6 Properly set deleted data for UpdateMemberForm and display suspended env access text
Styling for env name and role in update app member perms form
2019-11-12 16:54:46 -05:00
leigh-mil
d40c11a8f6 Change how env_roles are updated
This change makes it so that when an env_role is updated to be None, the
role property on the env_role is changed to be None in addition to being
marked as deleted. This also adds in a check so that previously deleted
env_roles cannot be reassigned a role.
2019-11-12 16:54:46 -05:00
leigh-mil
d324ec57ec Add field for deleted in the app members environment form 2019-11-12 16:54:46 -05:00
leigh-mil
54f3c2f8ba Update text and icon in modal
Update env_role status when it is deleted
2019-11-12 16:54:46 -05:00
leigh-mil
9037c44498 Move filter out of class definition and change name of form field 2019-11-12 13:07:50 -05:00
leigh-mil
ab9b62f54b Update validators and filter to remove strings that contain only
whitespace

The validator ListItemRequired() was only checking for None and an empty
string, not for strings that were multiple whitespace characters. This
fixes this issue by checking each item with regex to make sure it
contains non whitespace characters

The filter remove_empty_string() also was not checking for strings that
were multiple whitespace characters. This was also fixed by using regex
tomake sure that the string contains non whitespace characters, and also
clips any trailing whitespace.
2019-11-12 13:07:50 -05:00
dandds
1b6239893b Maintain static list of CRL URIs and issuers.
The previous solution (ad-hoc stream-parsing the CRLs to obtain their
issuers and nextUpdate) was too cute. It began breaking on CRLs that had
an addition hex 0x30 byte somewhere in their header. I thought that 0x30
was a reserved character only to be used for tags in ASN1 encoded with
DER; turns out that's not true. Rather than write a full-fledged ASN1
stream-parser, the simplest solution is to just maintain the list of
issuers as a constant in the codebase. This is fine because the issuer
for a specific CRL URI should not change. If it does, we've probably got
bigger problems.

This also removes the Flask app's functionality for updating the local
CRL cache. This is being handled out-of-band by a Kubernetes CronJob
and is not a concern of the app's. This means that instances of the
CRLCache do not have to explicitly track expirations for CRLs.
Previously, the in-memory dictionary or CRL issuers and locations
included expirations; now it is flattened to not include that
information.

The CRLCache class has been updated to accept a crl_list kwargs so that
unit tests can provide their own alternative CRL lists, since we now
hard-code the expected CRLs and issuers. The nightly CRL check job has
been updated to check that the hard-coded list of issuers matches what
we get when we actually sync the CRLs.
2019-11-12 05:43:11 -05:00
leigh-mil
3d92ac4840
Merge pull request #1164 from dod-ccpo/env-members-bugfix
Environment bugfixes
2019-11-08 13:23:03 -05:00
dandds
1654d2ea9f Create CRL_STORAGE_CONTAINER if it does not exist.
In local development, the app will fail to start if it does not find the
directory specified by CRL_STORAGE_CONTAINER. This adds a few lines to
safely create that directory on startup and corresponding tests.
2019-11-08 06:21:56 -05:00
graham-dds
e6d9dcf4bd
Merge pull request #1168 from dod-ccpo/bugfix/sort_environments
Bugfix: Ensure environment names are sorted when rendered
2019-11-07 13:55:13 -05:00
leigh-mil
e5f83d2456 Update relationship between Environment and EnvironmentRole so only environment roles that are not deleted are included 2019-11-07 11:53:37 -05:00
graham-dds
f705ac2303 Ensure env roles are sorted for each member 2019-11-07 09:36:45 -05:00
graham-dds
6bc1e0ba9a Ensure environment names are sorted when rendered 2019-11-06 11:53:31 -05:00
dandds
7ac29eff56 CRL test should skip JSON cache. 2019-11-06 06:08:48 -05:00
dandds
0b5acde4c4 Stream-parse CRLs for caching file locations.
AT-AT needs to maintain a key-value CRL cache where each key is the DER
byte-string of the issuer and the value is a dictionary of the CRL file
path and expiration. This way when it checks a client certificate, it
can load the correct CRL by comparing the issuers. This is preferable to
loading all of the CRLs in-memory. However, it still requires that AT-AT
load and parse each CRL when the application boots. Because of the size
of the CRLs and their parsed, in-memory size, this leads to the
application spiking to use nearly 900MB of memory (resting usage is
around 50MB).

This change introduces a small function to ad-hoc parse the CRL and
obtain the information in the CRL we need: the issuer and the
expiration. It does this by reading the CRL byte-by-byte until it
reaches the ASN1 sequence that corresponds to the issuer, and then looks
ahead to find the nextUpdate field (i.e., the expiration date). The
CRLCache class uses this function to build its cache and JSON-serializes
the cache to disk. If another AT-AT application process finds the
serialized version, it will load that copy instead of rebuilding it. It
also entails a change to the function signature for the init method of
CRLCache: now it expects the CRL directory as its second argument,
instead of a list of locations.

The Python script invoked by `script/sync-crls` will rebuild the
location cache each time it's run. This means that when the Kubernetes
CronJob for CRLs runs, it will refresh the cache each time. When a new
application container boots, it will get the refreshed cache.

This also adds a nightly CircleCI job to sync the CRLs and test that the
ad-hoc parsing function returns the same result as a proper parsing
using the Python cryptography library. This provides extra insurance
that the function is returning correct results on real data.
2019-11-04 08:36:03 -05:00
tomdds
d0746a3bf6 Cleanup imports and formatting in azure testing code 2019-10-30 16:43:59 -04:00