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

Support for identity/GetMembers #87

Merged
merged 3 commits into from
Feb 16, 2022
Merged

Support for identity/GetMembers #87

merged 3 commits into from
Feb 16, 2022

Conversation

denvenafi
Copy link
Contributor

No description provided.

@denvenafi denvenafi linked an issue Feb 14, 2022 that may be closed by this pull request
VenafiPS/Public/Get-TppIdentity.ps1 Outdated Show resolved Hide resolved
$assocParams.UriLeaf = 'Identity/GetMembers'
$assocParams.Body.Add("ResolveNested","1");
$members = Invoke-VenafiRestMethod @assocParams
$response | Add-Member @{ 'Members' = $members.Identities}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should look for the response to be consistent. an identity typically consists of ID, Name and Path. $members.Identities returns quite a bit more than that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Identities returned by GetMembers is the same data returned by GetAssociatedEntries , it is an array of type "Identity Entry Object". So how is it not consistent ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not consistent with what Get-TppIdentity returns which is ID, Name, Path, and IsGroup. associated should be updated as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can make those updates.

if (($response.IsGroup) -and ($IncludeMembers)) {
$assocParams = $params.Clone()
$assocParams.UriLeaf = 'Identity/GetMembers'
$assocParams.Body.Add("ResolveNested","1");
Copy link
Collaborator

Choose a reason for hiding this comment

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

to keep consistent syntax

Suggested change
$assocParams.Body.Add("ResolveNested","1");
$assocParams.Body.ResolveNested = '1'

Copy link
Contributor Author

@denvenafi denvenafi Feb 15, 2022

Choose a reason for hiding this comment

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

I prefer the explicit syntax since it emphasizes that that is a new key, as opposed to simply updating an existing one. Coding wise I think that makes it easier to read . I can go either way though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Typically it's best to follow the convention of the existing code so it's all the same.

Copy link
Collaborator

@gdbarron gdbarron left a comment

Choose a reason for hiding this comment

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

nice work @denvenafi!

@gdbarron gdbarron merged commit 9c7509f into main Feb 16, 2022
@gdbarron gdbarron deleted the issue83-V2-IncludeMembers branch February 16, 2022 18:47
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.

Identity/GetMembers
2 participants