-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add connection_id to machine user API creation #438
Conversation
…r to set ID/url, and delete from COTAK when connection deleted.
@ingalls here is a revamped PR for the integration stuff. To restate the problem: The whole point of the "integrations" in COTAK is to keep track of machine users. To do this, we need to be able to click on the management_url link in COTAK and go direct to the specific Connection in ETL associated with that MU. We also need ETL to do housekeeping when deleting connections, and delete the associated integration and MU's (see comment further on about deleting MU's). This PR attempts to work around the chicken & egg problem, with the MU & integration being created before the connection is created, by updating the COTAK integration after the connection has been created. When creating the machine user, the integration ID (from COTAK) is now being returned to the Vue component (via an extra emit) and added to the connection data. If that integrationId is present in the post data, the connection create API then patches the COTAK integration API to set the correct management_url and external_identifier (your connection ID) on the integration. That then also allows the connection delete API to call COTAK to delete the integration (using the connection ID as the key). Note, when deleting the integration, there is an optional query param you can add to also delete the associated machine user(s). I didn't add that as I'm not 100% sure you would want to do that. Deleting them would also delete their cert in TAK. I left a comment in the code for ya. I tested all this as well as I was able to, talking to the staging COTAK and TAK servers from my local dev box. It seems to be working. Is there a test suite I should add some unit tests to? Oh ... and ... I tried really hard to maintain the code style formatting. Spent a while tweaking my IDE settings. I think I fixed everything, except where it is insisting on splitting those sql'' lines. No idea why it's doing that, and I can't seem to make it not do that. Apologies. |
When creating a machine user via the COTAK API, set the management_url to the full /connection/{connection_id} URL, so admins can easily find the exact CloudTAK connection from the COTAK integrations page.