74 Commits

Author SHA1 Message Date
graham-dds
108f65f928 Use pendulum for datetime operations when possible
Currently, we use both Python's built-in datetime library and Pendulum
to do datetime operations. For the sake of consistency, we should try to
stick to one library for datetimes. We could have used either, but
Pendulum has a more ergonomic API, so I decided to go with it when
possible.

The places where were we didn't / couldn't replace datetime are:
- checking instances of datetimes. Pendulum's objects are subclasses of
  python native datetime objects, so it's still useful to import
  datetime in those cases of using is_instance()
- WTForms date validators expect datetime style string formats --
  Pendulum has its own format for formatting/ parsing strings. As such,
  our custom validator DateRange needs to use datetime.stptime() to
  account for this format.
2020-02-17 10:38:52 -05:00
tomdds
9acbeeb824 Add display name to subscription creation payload
Also extracts environment -> subscription payload construction to it's own method.
2020-01-31 14:42:38 -05:00
tomdds
afcc4d16cd Add functionality for creating and verifying subscriptions.
Currently the create call will be consumed by on-demand requests from the frontend, and the 2 stage create will be used by the enviroment management group provisioning to verify an initial subscription was created.
2020-01-30 15:58:09 -05:00
tomdds
5b0a523e92 Use more specific imports for cloud models and exceptions. 2020-01-26 15:52:55 -05:00
leigh-mil
31b7e2f589 Create route and domain method for creating a subscription 2020-01-23 16:44:07 -05:00
leigh-mil
36fe777230 Remove delete environments from app members form 2020-01-22 15:53:40 -05:00
graham-dds
156d733aee Add missing regex and validation for StringFields
This commit adds further validation for StringFields that were missing
it. This mostly amounted to being Regex patters and max lengths.
2020-01-22 15:20:18 -05:00
leigh-mil
11b3120bfd Update filter functions to display properly when users env access has been revoked 2020-01-14 15:43:46 -05:00
leigh-mil
17864cc060 Add migration to change environment_roles role column from string to
enum type.
Fix tests and functions affected by the column type change.
2020-01-14 13:12:29 -05:00
leigh-mil
ff0abe7dce
Merge branch 'staging' into remove-delete-functionality 2019-12-18 15:20:41 -05:00
leigh-mil
5b55b5800e Remove route, tests, and template code for deleting an application 2019-12-18 12:18:43 -05:00
leigh-mil
d300ccf31b Catch error on update applications route when app name is duplicated within a portfolio 2019-12-18 10:54:18 -05:00
leigh-mil
63a5d9274b Update route to handle error when env names are duplicated 2019-12-18 10:54:17 -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
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
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
leigh-mil
e8f21acf5b PR fixes 2019-11-12 16:59:22 -05:00
leigh-mil
d324ec57ec Add field for deleted in the app members environment form 2019-11-12 16:54:46 -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
richard-dds
96c1fcbe85
Merge branch 'master' into revert-user-deletion 2019-10-15 17:06:06 -04:00
leigh-mil
91ce3dda9e Disable the App Role when revoking an invite. 2019-10-15 14:25:21 -04:00
richard-dds
1bce0a1f01 Revert user deletion job 2019-10-14 16:51:19 -04:00
richard-dds
0c480ccc41 Fix tests 2019-10-08 16:42:25 -04:00
leigh-mil
12aad96899 hard code initial invite email 2019-10-08 16:16:34 -04:00
leigh-mil
4d043363a7 Create route for resending an app invite
Replace ApplicationInvitations._update_status() with revoke() because multiple functions used _update_status() and it was causing app roles to be disabled when they shouldn't have. Now app roles are disabled within the revoke function.
Updated Invitations.resend() to accept user details so the invite info
can be changed in the new invite
2019-10-08 15:59:16 -04:00
leigh-mil
875b908908 Do not change app role status when invite status changes, add assertions to tests for this 2019-10-03 14:56:38 -04:00
graham-dds
de89bb03b0 use correct route for create member macro 2019-10-02 14:17:18 -04:00
graham-dds
337c98f8cd Add / update tests
- add tests for step3 of new application
2019-10-01 15:56:18 -04:00
graham-dds
4aa0afdb67 New env role logic in filter_env_roles_form_data 2019-09-30 15:41:00 -04:00
leigh-mil
5c54c043c0 Add route for applications.revoke_invite 2019-09-26 09:46:23 -04:00
leigh-mil
b35e8cfe8e Update NewMemberForm so that it has the same data structure as the UpdateMemberForm 2019-09-18 11:16:55 -04:00
leigh-mil
a7f9be5d48 Add comments to explain test 2019-09-18 11:16:55 -04:00
leigh-mil
cf172c486c Remove test for old applications.settings data structure and replace with test for refactored get_members_data() function 2019-09-18 11:16:55 -04:00
leigh-mil
80dcb9c580 Move perms so they are at the top level of the form so that the data is properly populated
Add form fields for all environments in update member form
2019-09-18 11:16:54 -04:00
leigh-mil
93530e903f Create route for updating app member 2019-09-18 11:16:54 -04:00
richard-dds
79c8e4fc63
Merge pull request #1062 from dod-ccpo/env-provisioning-task
Environment provisioning background jobs
2019-09-16 09:58:18 -04:00
leigh-mil
ddcd91964f Remove route 'applications.update_env_roles' and related functions and tests 2019-09-11 15:29:09 -04:00
richard-dds
f6cb6f2a31 Change Environment.creator relation from ApplicationRole to User 2019-09-11 11:42:59 -04:00
leigh-mil
e391c3269d Remove unused route to update team roles 2019-09-09 15:23:37 -04:00
leigh-mil
7c7624f25e Move team routes to the settings file and delete files related to applications/team 2019-09-05 16:54:16 -04:00
dandds
3c5df7b1aa Some environments might not have associated users.
There was a bug in the application settings route that threw an error if
an environment role and its associated application role did not have an
associated user. Updated to check for the user name on the application role.
2019-06-19 10:12:01 -04:00
dandds
df06d1b62f Use application_role_id on environment_roles.
In the future, an `application_invitation1 will not refer to a `user` until
someone accepts the invitation; they'll only reference an
`application_role`. When a user is invited to an application, the
inviter can specify the environments the invitee should have access to.
For this to be possible, an `environment_role` should reference an
`application_role`, because no `user` entity will be known at that time.

In addition to updating all the models and domain methods necessary for
this change, this commit deletes unused code and tests that were
dependent on `environment_roles` having a `user_id` foreign key.
2019-05-31 11:21:20 -04:00
dandds
43ea922218 Simplify environment role updates in app settings.
Use ApplicationRole.id instead of User.id in forms. This eliminates the
need for the function that checks whether a user is in a given
application, because looking up the application role will raise an error
if the user is not.
2019-05-24 13:35:00 -04:00
leigh-mil
927d1b7925 Add audit log to app settings page 2019-05-22 13:08:44 -04:00
dandds
815632ed00 Handle setting no access for user environment roles:
- use constant for no access string
- update no access constant
- update language and permissions for rendering remove app member button
2019-05-17 14:00:45 -04:00