Skip to content
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

Merged
merged 13 commits into from
Dec 13, 2024
Merged

Add connection_id to machine user API creation #438

merged 13 commits into from
Dec 13, 2024

Conversation

cheesegrits
Copy link
Contributor

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.

@cheesegrits
Copy link
Contributor Author

cheesegrits commented Dec 11, 2024

@ingalls here is a revamped PR for the integration stuff.

#377 #378

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.

api/routes/connection.ts Outdated Show resolved Hide resolved
api/routes/connection.ts Outdated Show resolved Hide resolved
api/routes/connection.ts Outdated Show resolved Hide resolved
api/routes/ldap.ts Outdated Show resolved Hide resolved
@ingalls ingalls self-assigned this Dec 13, 2024
@ingalls ingalls merged commit 5fc73a0 into main Dec 13, 2024
13 checks passed
@ingalls ingalls deleted the management-url branch December 13, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants