fix: Enhance SCIM payload handling and attribute creation#18427
Merged
hariombalhara merged 2 commits intomainfrom Jan 3, 2025
Merged
fix: Enhance SCIM payload handling and attribute creation#18427hariombalhara merged 2 commits intomainfrom
hariombalhara merged 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (12/31/24)1 reviewer was added to this PR based on Keith Williams's automation. |
Contributor
E2E results are ready! |
67dd2d8 to
63013d4
Compare
- Introduced a new PR_TODO.md file to track ongoing tasks and fixes. - Updated `getAttributesFromScimPayload` to accept a directoryId and ignore core user attributes during syncing. - Modified `handleUserEvents` to pass directoryId when syncing custom attributes. - Improved attribute creation logic to handle unique options and added support for optional isGroup property in attribute options. - Added utility function `getOptionsWithValidContains` to ensure valid sub-options in attribute options. - Updated tests to reflect changes in attribute handling and ensure proper functionality. This commit addresses issues with user attribute syncing and enhances the overall attribute management process.
- Introduced a new test file for the getOptionsWithValidContains function. - Added tests to verify the removal of duplicate options, initialization of empty contains arrays, filtering of non-existent sub-options, and handling of empty options arrays. - Ensured comprehensive coverage of the utility's functionality to enhance reliability and maintainability.
hariombalhara
commented
Dec 31, 2024
| }); | ||
|
|
||
| // User is already a part of that org | ||
| if (user && UserRepository.isAMemberOfOrganization({ user, organizationId }) && eventData.active) { |
Member
Author
There was a problem hiding this comment.
It was causing the update to not sync attribues as the user is already a part of org.
hariombalhara
commented
Dec 31, 2024
| org, | ||
| directoryId, | ||
| }); | ||
| if (UserRepository.isAMemberOfOrganization({ user, organizationId })) { |
Member
Author
There was a problem hiding this comment.
Still allow attributes sync for existing user.
hariombalhara
commented
Dec 31, 2024
| const slug = slugify(input.name); | ||
| const options = input.options.map((v) => v.value); | ||
| const optionsWithoutDuplicates = Array.from(new Set(options)); | ||
| const uniqueOptions = getOptionsWithValidContains(input.options); |
Member
Author
There was a problem hiding this comment.
Using common utility
hariombalhara
commented
Dec 31, 2024
| type: z.enum(["TEXT", "NUMBER", "SINGLE_SELECT", "MULTI_SELECT"]), | ||
| isLocked: z.boolean().optional(), | ||
| options: z.array(z.object({ value: z.string() })), | ||
| options: z.array(z.object({ value: z.string(), isGroup: z.boolean().optional() })), |
Member
Author
There was a problem hiding this comment.
It was causing a groupOption to become regular option when created during the attribute creation itself.
MuhammadAimanSulaiman
pushed a commit
to hit-pay/cal.com
that referenced
this pull request
Jan 10, 2025
* feat: Enhance SCIM user attribute handling and sync process - Introduced a new PR_TODO.md file to track ongoing tasks and fixes. - Updated `getAttributesFromScimPayload` to accept a directoryId and ignore core user attributes during syncing. - Modified `handleUserEvents` to pass directoryId when syncing custom attributes. - Improved attribute creation logic to handle unique options and added support for optional isGroup property in attribute options. - Added utility function `getOptionsWithValidContains` to ensure valid sub-options in attribute options. - Updated tests to reflect changes in attribute handling and ensure proper functionality. This commit addresses issues with user attribute syncing and enhances the overall attribute management process. * test: Add unit tests for getOptionsWithValidContains utility function - Introduced a new test file for the getOptionsWithValidContains function. - Added tests to verify the removal of duplicate options, initialization of empty contains arrays, filtering of non-existent sub-options, and handling of empty options arrays. - Ensured comprehensive coverage of the utility's functionality to enhance reliability and maintainability.
MuhammadAimanSulaiman
pushed a commit
to hit-pay/cal.com
that referenced
this pull request
Feb 20, 2025
* feat: Enhance SCIM user attribute handling and sync process - Introduced a new PR_TODO.md file to track ongoing tasks and fixes. - Updated `getAttributesFromScimPayload` to accept a directoryId and ignore core user attributes during syncing. - Modified `handleUserEvents` to pass directoryId when syncing custom attributes. - Improved attribute creation logic to handle unique options and added support for optional isGroup property in attribute options. - Added utility function `getOptionsWithValidContains` to ensure valid sub-options in attribute options. - Updated tests to reflect changes in attribute handling and ensure proper functionality. This commit addresses issues with user attribute syncing and enhances the overall attribute management process. * test: Add unit tests for getOptionsWithValidContains utility function - Introduced a new test file for the getOptionsWithValidContains function. - Added tests to verify the removal of duplicate options, initialization of empty contains arrays, filtering of non-existent sub-options, and handling of empty options arrays. - Ensured comprehensive coverage of the utility's functionality to enhance reliability and maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detailed Changes:
getAttributesFromScimPayloadto acceptdirectoryIdand ignore core attributes as defined in the SCIM spec.handleUserEventsto passdirectoryIdwhen callinggetAttributesFromScimPayload.getAttributesFromScimPayloadto reflect the new parameter and behavior.attributes-create-view.tsxto streamline attribute submission.isGroupproperty for options.getOptionsWithValidContainsto ensure valid sub-option references during attribute creation.These changes improve the robustness of user event handling and attribute management in the application.
What does this PR do?
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?