1411 Commits

Author SHA1 Message Date
dandds
05f6b36ece Update SQL query to find pending portfolios.
The query to find portfolios that are pending provisioning is updated to
check for:

- a period of performance that has started
- a portfolio state machine that has an UNSTARTED or one of the CREATED
  states

I left several TODOs to ensure that the orchestration functions
correctly for portfolio.
2020-02-04 10:16:02 -05:00
dandds
bb7cbf00cd Add microsoft domain to AAD user names. 2020-02-03 11:17:42 -05:00
dandds
6b8d9d1d65 Celery wrapper for creating a user. 2020-02-02 14:42:44 -05:00
dandds
cc28f53999 Function for claiming multiple resources at once.
Like claim_for_update, the claim_many_for_update claims resources with
an expiring lock. This was written to allow the updating of multiple
application roles with a single cloud_id, since multiple application
roles will map to a single Azure Active Directory user.
2020-02-02 14:19:13 -05:00
dandds
1b45502fe5 SQLAlchemy query for finding ApplicationRoles ready for provisioning.
This adds a query method to return the IDs of the application roles that
should be provisioned as users in Azure. We will provision one Azure
Active Directory user per ATAT user in a portfolio, meaning that one AAD
user might correspond to multiple application roles under a single
portfolio. The query method returns IDs in a nested list grouped by
portfolio and user because of this.

add method for getting app roles that are pending creation

update application_roles query to group by portfolio

check for user existing and role status correct when filtering ApplicationRole for creation
2020-02-02 14:03:17 -05:00
tomdds
61e891258b Merge branch 'staging' into azure-subscriptions 2020-01-31 17:00:43 -05:00
tomdds
6952a533e2
Merge branch 'staging' into product-purchase-provisioning 2020-01-31 15:50:31 -05:00
tomdds
bbed83d897 Update AADP Purchase url and respose format to newer schema. 2020-01-31 15:50:10 -05:00
tomdds
53dcb94046
Merge branch 'staging' into azure-subscriptions 2020-01-31 15:43:08 -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
670e135a0e
Merge branch 'staging' into azure-subscriptions 2020-01-31 14:41:39 -05:00
graham-dds
e32e211966 Make Upload related classes more generic
Renames Python classes that refer to Upload to something to FileService.
We added this change because these classes now handle downloading as
well as uploading.
2020-01-31 13:17:00 -05:00
graham-dds
a7770d8a6a Add method to download TOs from Azure 2020-01-31 13:17:00 -05:00
graham-dds
00a5a98577 Add Mailer class method to email TOs to MSFT 2020-01-31 13:17:00 -05:00
tomdds
ba84b92795
Merge branch 'staging' into product-purchase-provisioning 2020-01-31 13:13:07 -05:00
leigh-mil
dff9924c95 Make file size limit configurable 2020-01-31 11:59:07 -05:00
tomdds
6b8ea41925 Make AADP purchase quantity configurable
Also remove a few constant params from the payload model.
2020-01-30 22:12:28 -05:00
29b69a7d5d code formatting 2020-01-30 16:50:32 -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
7e4340e7e4 resolve merge conflict with staging 2020-01-30 15:57:06 -05:00
7493b9c3d6 premium product purchase unit tests. 2020-01-30 14:48:16 -05:00
leigh-mil
0a7541ef99 Remove unused mock csp routes, templates, and images. Remove unused JEDIhierarchy image 2020-01-30 14:09:12 -05:00
tomdds
6480060b8d
Merge branch 'staging' into azure-admin-provisioning 2020-01-30 11:17:33 -05:00
graham-dds
05ef9131dd
Merge branch 'staging' into safe_redirect 2020-01-30 10:42:33 -05:00
tomdds
33c6e8c68c Merge CSP secret handling implementations and refine updating. 2020-01-29 18:22:21 -05:00
tomdds
0bc0e15134 Merge branch 'staging' into azure-config-values 2020-01-29 16:50:44 -05:00
tomdds
d4dd581b7a Implement principal creation and admin elevation provisioning features. 2020-01-29 16:17:28 -05:00
leigh-mil
f48404215a
Merge branch 'staging' into to-builder-previous-button 2020-01-29 15:09:27 -05:00
graham-dds
82ef8f3574 Add fn to ensure a url matches an app url pattern
In some functions, we redirect a user based on a parameter in a query
string.  This commit adds a function that checks to see if a given url
matches a url pattern of a view function. This will help us ensure that
the url passed  as the next parameter isn't malicious.
2020-01-29 13:24:12 -05:00
d042282ca0 test state machine update expected states 2020-01-29 12:51:59 -05:00
dandds
63b5ddbdd4 Merge branch 'staging' into app-env-provisioning 2020-01-29 11:16:55 -05:00
dandds
abd03be806 Store and pull tenant creds from Key Vault.
The tenant ID should be hashed and used as the key for the JSON blob of
relevant creds for any given tenant. Azure CSP interface methods that
need to source creds should call the internal `_source_creds` method,
either with a `tenant_id` or no parameters. That method will source the
creds. If a tenant ID is provided, it will source them from the Key
Vault. If not provided, it will return the default creds for the app
registration in the home tenant.
2020-01-29 10:49:27 -05:00
tomdds
144312863c Draft implementations of remote admin creation and root management group ownership. 2020-01-28 20:14:50 -05:00
tomdds
7bf6b9addc Remove creds from payloads and passthroughs. 2020-01-28 14:12:04 -05:00
dandds
67bfe09bbf
Merge branch 'staging' into alpha-numeric-to-numbers 2020-01-28 11:24:40 -05:00
tomdds
475ceaed7c Source Azure Environment Values from Config
This commit switches a few previously hardcoded values to be parsed from configuration, either from the SDK or current consts.
2020-01-27 16:49:19 -05:00
leigh-mil
99edf3df90 Save valid TO form fields when clicking previous in TO builder 2020-01-27 11:56:09 -05:00
dandds
a10d733fb7 Fix test and LGTM warnings.
- Fixes LGTM warnings for an unused import and equality comparisons to
  None in SQLAlchemy filters.
- Removes part of a unit test asserting that the claimed_until locking
  mechanism works correctly. If I recall correctly, this does not work
  in unit tests because the test takes place inside a transaction, and
  the database provider does evaluate the current time until the
  transaction is written.
2020-01-27 06:27:18 -05:00
dandds
ef8f92b678 Merge branch 'staging' into app-env-provisioning 2020-01-26 18:56:29 -05:00
dandds
37a5218a1d Split and barrel cloud module for merge. 2020-01-26 18:38:02 -05:00
tomdds
5b0a523e92 Use more specific imports for cloud models and exceptions. 2020-01-26 15:52:55 -05:00
tomdds
466a575229 Move portfolio state machine helpers directly to model file to prevent import issues.
Having `get_stage_csp_class` in the csp module meant that any file that interacted with that import path would throw an error in a REPL. This will allow importing of the Azure and Mock providers for interactive dev.
2020-01-26 15:17:53 -05:00
tomdds
d02d47615e First step in breaking out cloud.py
Move cloud.py to a module init. Move policy with it. Update related unit tests. Also adds a patch to state machine test to prevent randomness in mock from failing test.
2020-01-26 14:03:09 -05:00
dandds
8810a59e0a Orchestration for creating app management groups.
This adds:
- A Celery beat task for enqueuing application creation tasks
- A Celery task for creating the application
- Payload and Response dataclasses for creating management groups

It also does some incidental cleanup.
2020-01-26 12:23:33 -05:00
dandds
bfc0692063 Remove multiple job failure tables in favor of one.
We don't know yet how useful the job failue tables will be, and
maintaining multiple failure tables--one for every entity involved in
CSP provisioning--is burdensome. This collapses them all into a single
table that track the entity type (environment, portfolio, etc.) and the
entity ID. That way we can construct queries when needed to find task
results.
2020-01-25 15:50:01 -05:00
dandds
02438dc39b Query for applications that need to be provisioned.
Adds a method to the Applications domain class that can return a list of
UUIDs for applications that are ready to be provisioned. It requires
that:

- the associated portfolio and state machine have a state of COMPLETED
- the application not have been marked deleted
- the application not have an existing cloud_id
- the application does not have an existing claim on it
2020-01-25 14:30:17 -05:00
tomdds
f08d53d7a0 Transition all Cloud Interface Methods to use Dataclasses 2020-01-24 15:42:23 -05:00
tomdds
b9206ed7be Some more LGTM fixes 2020-01-24 13:35:46 -05:00
tomdds
35eea8e31c
Merge branch 'staging' into azure-custom-integration 2020-01-24 11:16:11 -05:00
tomdds
e9d03ec68b Fix some LGTM errors and start sketching in credential update functionality 2020-01-24 11:15:35 -05:00