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 support for multiple users in ad template #5994

Merged
merged 3 commits into from
Jan 8, 2024
Merged

Conversation

hgreebe
Copy link
Contributor

@hgreebe hgreebe commented Jan 5, 2024

Description of changes

  • Add support for multiple users in ad template
  • Allows a list of comma separated user names to be inputted in order to create multiple users

Tests

  • Created an AD with multiple users, integrated it with a cluster, and logged in to multiple users

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6e397cc) 90.18% compared to head (255a0ad) 90.18%.

❗ Current head 255a0ad differs from pull request most recent head e314928. Consider uploading reports for the commit e314928 to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5994   +/-   ##
========================================
  Coverage    90.18%   90.18%           
========================================
  Files          180      180           
  Lines        15777    15777           
========================================
  Hits         14228    14228           
  Misses        1549     1549           
Flag Coverage Δ
unittests 90.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hgreebe hgreebe added the skip-changelog-update Disables the check that enforces changelog updates in PRs label Jan 5, 2024
@hgreebe hgreebe marked this pull request as ready for review January 5, 2024 14:50
@hgreebe hgreebe requested review from a team as code owners January 5, 2024 14:50
@hgreebe hgreebe changed the title Add suport for multiple users in ad template Add support for multiple users in ad template Jan 5, 2024
cloudformation/ad/ad-integration.yaml Outdated Show resolved Hide resolved
UserPassword:
Description: Cluster user Password.
Description: Cluster user Password for all users.
Copy link
Contributor

Choose a reason for hiding this comment

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

minor I'd rephrase "Password for all the users specified in 'Users' parameter.

cloudformation/ad/ad-integration.yaml Outdated Show resolved Hide resolved
@@ -561,7 +565,8 @@ Resources:
response_data['Message'] = 'Resource creation successful!'
physical_resource_id = create_physical_resource_id()
ds.reset_user_password(DirectoryId=directory_id, UserName='ReadOnlyUser', NewPassword=read_only_password)
ds.reset_user_password(DirectoryId=directory_id, UserName=user_name, NewPassword=user_password)
for name in user_names.split(","):
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to sanitize user_names by trimming it to avoid the risk of having user names with blank spaces.

The reason why I'm suggesting this here in Python code but not in the bash code above is because in the bash code you implicitly sanitized it using sed replacement within bash arrays.

@@ -561,7 +565,9 @@ Resources:
response_data['Message'] = 'Resource creation successful!'
physical_resource_id = create_physical_resource_id()
ds.reset_user_password(DirectoryId=directory_id, UserName='ReadOnlyUser', NewPassword=read_only_password)
ds.reset_user_password(DirectoryId=directory_id, UserName=user_name, NewPassword=user_password)
for name in user_names.split(","):
name = name.strip()
Copy link
Contributor

@gmarciani gmarciani Jan 8, 2024

Choose a reason for hiding this comment

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

Minor It's ok to strip here, but just for sharing: in this way you strip once per every username. If you strip user_names when defining the loop instead you strip just once for all.

@hgreebe hgreebe enabled auto-merge (squash) January 8, 2024 12:51
@hgreebe hgreebe merged commit b759cb2 into aws:develop Jan 8, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog-update Disables the check that enforces changelog updates in PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants