-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix/661/additional attributes #729
Conversation
nc-fkl
commented
Dec 7, 2023
- Added multiple attributes
- Aligned mapping
- Aligned frontend layout a littlebit so that its more categorized
- Setting newly added properties of account via IAccountManager instead of IUser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Unit and integration tests don't pass.
I'll make real life tests when they do.
lib/Service/ProvisioningService.php
Outdated
$event = new AttributeMappedEvent(ProviderService::SETTING_MAPPING_UID, $idTokenPayload, $tokenUserId); | ||
$this->eventDispatcher->dispatchTyped($event); | ||
|
||
$backendUser = $this->userMapper->getOrCreate($providerId, $event->getValue()); | ||
$backendUser = $this->userMapper->getOrCreate($providerId, (string)$event->getValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you cast to get an empty string if the value is null? If so, it would require a comment and do it like:
$backendUser = $this->userMapper->getOrCreate($providerId, (string)$event->getValue()); | |
$backendUser = $this->userMapper->getOrCreate($providerId, $event->getValue() ?? ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actualy my ide marked it as error that's not casted, that was the only reason for that :) took your solution now
lib/Service/ProvisioningService.php
Outdated
// filter out empty values | ||
$addressParts = array_filter($addressParts, function($value) { | ||
return !empty($value); | ||
}); | ||
// concatenate them back together into a string and remove unsused ', ' | ||
$address = preg_replace('/^, |, $/', '', str_replace(' ', ' ', implode(', ', $addressParts))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you have empty parts and you remove them, the result string will be in the wrong format. If the street is missing, then the postal code will be seen as the street. I think we need a fixed number of fields as they are identified by their position. No problem with empty ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good point, makes sense, so lets keep the "ugly" string when a value was not provided, will also be a good hint for the user/admin itself that a value isn't set correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the unit tests output. They need to be adjusted with the new setting values.
if ($mapping = $input->getOption('mapping-groups')) { | ||
$this->providerService->setSetting($provider->getId(), ProviderService::SETTING_MAPPING_GROUPS, $mapping); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to add this option in the configure method. This will make the integration tests pass.
d51d4b9
to
fd0ef87
Compare
I guess everything should be fixed and fine now, can you please review again @julien-nc ? Thx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, i tried with a few attributes, works like a charm.
It would be nice to hide all those setting fields and make them appear/disappear if user clicks on a "Extra attributes mapping" button.
Also, now there are conflicts with main. Nothing weird, the new options in the UpSert command are added on the same line. Let me know if you need help to solve the conflicts.
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
…justed Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
Signed-off-by: Florian Klinger <[email protected]>
c6191fb
to
9ea902d
Compare
Rebased and added expandable/collapsable extra attributes. Would be nice if you can review again 🏓 , thank you @julien-nc :) |
Signed-off-by: Julien Veyssier <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woop woop
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |