Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

feat: migrates creating a user using ldap #107

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

tdstein
Copy link
Collaborator

@tdstein tdstein commented Jul 1, 2024

Note that I have some in-flight work to simply the Python implementation. Here is the groups implementation. The users implementation will be similar: posit-dev/posit-sdk-py#228

@tdstein tdstein requested a review from toph-allen July 1, 2024 20:05
Copy link
Collaborator

@toph-allen toph-allen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes. I would have kept most of what you removed from the R section.

We have one user here, `Myra Francis`, username: `francism`. `francism` does not have a GUID, which means that they do not have a user account on Connect.

Included in the API response for each user is a `temp_ticket` value, which can be used to create the user in Connect.
The `results` object also contains a field named `temp_ticket`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still important to explain that the null GUID is how you tell that a user doesn't have a Connect account.

Suggested change
The `results` object also contains a field named `temp_ticket`.
We can tell that the user `francism` does not have a user acocunt on Connect because their `guid` is `null`. The field `temp_ticket` can be used in a subsequent request to create an account on Connect.

Comment on lines 48 to 52
```python
ticket = results[0]['temp_ticket']
```

#### Creating the user
We use this value to create the user on Connect.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete these lines (see suggestions above and below. I cannot make a suggestion here because there are unchanged lines in here).

Comment on lines 54 to 51
```python
response = client.put("v1/users", json={"temp_ticket": ticket})
user = response.json()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```python
response = client.put("v1/users", json={"temp_ticket": ticket})
user = response.json()
```python
ticket = results[0]['temp_ticket']
response = client.put("v1/users", json={"temp_ticket": ticket})
user = response.json()

@tdstein tdstein force-pushed the tdstein/create-user-with-ldap branch from d55e11c to 1711e20 Compare July 2, 2024 14:17
@tdstein tdstein merged commit 10d7d37 into main Jul 2, 2024
1 check passed
@tdstein tdstein deleted the tdstein/create-user-with-ldap branch July 2, 2024 14:17
tdstein added a commit that referenced this pull request Jul 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants